DocsStorefront integrationWhat to send on every order
Coming soon Kwik's public API and MCP server are coming soon. These docs are an early preview, in the beginning stages: endpoints, fields and examples are samples and will change before launch. Brands on Kwik today can ask their account manager about integrations.
Read every docs page as one Markdown file, ready to paste into ChatGPT, Claude or any AI assistant.
Storefront integration · ReferenceWhat Kwik Needs On Every Order.
Every reward and every referral credit starts from an order. This is the data Kwik reads from each one, the fields that carry attribution, and the signals to send when an order changes. It applies to any platform.
Before you start
- Shopify stores: Kwik reads orders from Shopify for you. You only need the share code to reach the order (track share links).
- Other platforms: a server that can send each paid order, refund and cancellation to Kwik.
The signals Kwik needs
| Signal | When to send it | What Kwik does with it |
|---|---|---|
| Order paid | Once the payment goes through. Send it again if the order changes. | Finds who to credit, then calculates entries, points, cashback, commissions and Waves |
| Refund | For each full or partial refund | Takes back the rewards for what was refunded |
| Cancellation | When an order is cancelled | Takes back everything the order earned |
| Share-link visit (optional) | The Kwik Pixel records visits where it is installed | Reporting. Credit always comes from the order, not the visit. |
Rewards start as pending and clear after the return window, so a refund or cancellation that arrives later still counts.
The order body
This is the full shape, using the same hoodie and cap order as the other guides. Amounts are decimals in the order's currency. Times are ISO 8601 in UTC.
{
"order_id": "1042",
"order_number": "#1042",
"created_at": "2026-12-03T22:14:05Z",
"paid_at": "2026-12-03T22:14:09Z",
"status": "paid",
"currency": "USD",
"customer": {
"id": "8812",
"email": "jane@example.com",
"first_name": "Jane",
"last_name": "Lee",
"phone": "+15555550123",
"accepts_marketing": true
},
"line_items": [
{
"line_id": "1",
"product_id": "8100000000001",
"variant_id": "4400000000011",
"sku": "HOOD-BLK-M",
"title": "Hoodie",
"quantity": 1,
"unit_price": 40.00,
"amount_paid": 40.00,
"tags": ["outerwear"],
"collections": ["Winter"]
},
{
"line_id": "2",
"product_id": "8100000000002",
"variant_id": "4400000000022",
"sku": "CAP-BLK",
"title": "Cap",
"quantity": 1,
"unit_price": 20.00,
"amount_paid": 20.00,
"tags": [],
"collections": ["Accessories"]
}
],
"discount_codes": [{ "code": "WELCOME100", "amount": 0.00 }],
"subtotal": 60.00,
"discount_total": 0.00,
"shipping_total": 5.00,
"tax_total": 4.80,
"total": 69.80,
"attribution": {
"wave_link": "ABC123",
"landing_url": "https://yourstore.com/products/hoodie?waveLink=ABC123",
"first_seen_at": "2026-12-01T17:02:44Z"
}
}
| Field | Needed | What Kwik uses it for |
|---|---|---|
order_id | Required | One order, counted once. Sending the same id again updates it and never awards rewards twice. |
created_at, paid_at | Required | Which giveaway week and promotion the order falls in, and when holds start. |
status | Required | paid, partially_refunded, refunded or cancelled. Only paid orders earn. |
currency | Required | Reads every amount in the right currency. |
customer.email | Required | Who earns the rewards. It links the order to the shopper's Kwik account. |
customer.id, names, phone | Recommended | Matching repeat customers and personalizing emails. accepts_marketing keeps messages within consent. |
line_items[].product_id | Required | Product multipliers, product bonuses and excluded products. Use the same product ids Kwik has for the store (Shopify product ids on Shopify). |
line_items[].amount_paid | Required | What each line earns on: after discounts, before tax and shipping. |
line_items[].quantity, unit_price | Required | Flat per-item rewards and partial refunds. |
line_items[].tags, collections | Recommended | Tag and collection multipliers on large catalogs. |
line_items[].line_id, variant_id, sku | Recommended | Matching refunds to lines, and variant-level rules. |
discount_codes | Required if used | Promo-code bonuses, and credit for an ambassador's personal code, even without a share link. |
subtotal, discount_total, shipping_total, tax_total, total | Recommended | Reporting and checks. |
attribution.wave_link | Required if present | Who referred the order, the people before them (Waves), and the referral multiplier. |
attribution.landing_url, first_seen_at | Optional | Reporting on which links and pages bring orders. |
Never send card numbers or other payment details. Kwik doesn't need them.
Needs confirmationWhich order time places an order in a giveaway week (created or paid) and the exact field names for non-Shopify orders. Confirm both with your Kwik contact before you build. On Shopify, Kwik reads these from the Shopify order itself.
Where the share code goes
| Platform | Put the code here | Example |
|---|---|---|
| Any platform, order body | attribution.wave_link | "wave_link": "ABC123" |
| Shopify, cart attribute | Cart attribute waveLink (shows on the order as an attribute) | waveLink = ABC123 |
| Shopify, line attribute | Hidden line attribute _kwik_waveLink on each line (Kwik 2.0 app stores) | _kwik_waveLink = ABC123 |
| Shopify, order tag | Order tag, when the store's setup reads tags | waveLink=ABC123 |
- Send the code exactly as it arrived. It is case-sensitive, and only 1 to 64 letters and digits.
- The last link wins. If a shopper followed two reps' links, send the newer code.
- No code? Send nothing. Leave
attributionout or set it to null. Never guess or fill in a default rep. - Discount codes count too. An order that used an ambassador's personal code is credited to them even without a share link, so always send
discount_codes.
Shopify: where each field comes from
On Shopify stores you send nothing. Kwik reads the Shopify order as it is paid, with a regular full sync as a backup. This is how the fields line up, for checking an order by hand:
| Kwik field | Shopify order |
|---|---|
order_id, order_number | id, name |
created_at, paid_at, status | created_at, processed_at, financial_status and cancelled_at |
customer | customer and email |
line_items[].amount_paid | Line price × quantity, minus its discount_allocations |
discount_codes | discount_codes |
attribution.wave_link | The waveLink attribute (note_attributes), the _kwik_waveLink line property, or a waveLink= tag |
| Refunds | refunds |
Refunds and cancellations
Send one refund for each refund in your system, with the lines and amounts refunded. Kwik takes back the rewards for those lines only. For a cancellation, send the order again with status set to cancelled.
{
"order_id": "1042",
"refund_id": "r-7781",
"refunded_at": "2026-12-09T15:30:00Z",
"line_items": [
{ "line_id": "2", "quantity": 1, "amount": 20.00 }
],
"shipping_refunded": 0.00
}
Sending orders from another platform
Send orders from your server, never from the browser, because the request carries your secret key. Retry on errors: the same order_id is never counted twice.
// Server only. Run when an order is paid, and again for each refund or cancellation.
// Preview: the path and auth below are a sample. Get the current way to send orders from Kwik.
export async function sendOrderToKwik(order: KwikOrder) {
const res = await fetch('https://api.kwik.com/v1/orders', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.KWIK_API_KEY}`, // never in the browser
'Content-Type': 'application/json',
},
body: JSON.stringify(order), // the order body on this page
});
if (res.status === 429 || res.status >= 500) throw new Error('retry later'); // safe to retry: same order_id never counts twice
return res.json();
}
Needs confirmationThe self-serve orders endpoint is part of the API preview and not live yet. Today, non-Shopify order connections are set up with your Kwik contact. Build your order data in the shape on this page, and they will tell you where to send it.
End-to-end test
- Follow a share link (
?waveLink=ABC123) and place a test order with two products and a promo code. - Check your order record: the code is saved exactly as
ABC123, and the lines show amounts after discounts. - Send the order (or let Shopify sync it). In Kwik, the order shows the right customer, the rep behind
ABC123, and rewards matching your estimate. - Send the same order again. Nothing is awarded twice.
- Refund one line. Only that line's rewards are taken back.
- Place an order with no share link. It has no referrer, and the buyer still earns their own rewards.