Conversion API
The endpoint that receives sales – for server-side and custom integrations, with parameters, responses and limits.
Every sale from track.js ends up at the same endpoint. If you build the integration yourself – e.g. from your own backend once payment has gone through – you can call it directly.
POST https://app.affilyflow.com/api/track/conversion
GET https://app.affilyflow.com/api/track/conversion- Both
GETandPOSTwork.OPTIONSanswers CORS preflight requests. - CORS is open (
Access-Control-Allow-Origin: *), so the endpoint can be called from any browser. - No key is required. What ties the sale to an affiliate is the click ID – or a personal discount code.
The click ID first
Without the click ID the sale can't be attributed to anyone. It arrives from the affiliate link as ?afid= on your site, and track.js stores it in the af_click cookie on your domain. Your server can therefore read the cookie from the customer's request when the order is created and send it along.
If you don't have track.js on the site, store afid from the URL yourself – or the alias afy when afid is missing (same value; some ad-blocker filter lists remove afid). Always send it to us as afid. Only accept values that look like ours: c_ followed by 4–64 characters (letters, digits, _ and -).
Parameters
| Parameter | Alias | Required | Meaning |
|---|---|---|---|
afid | click_id | Yes, when there is a click | The click ID (c_…). Without a click, a personal discount code in coupon/coupons can attribute the sale. |
store | – | Recommended | Your store ID (the same as data-store). Must match the click's store, otherwise store_mismatch. |
order | order_id | Recommended | The order number. The same number is never counted twice in the same program. At most 120 characters. |
total | order_total | Yes | The amount commission is calculated on: goods after discount, excluding VAT and shipping. A machine number (1249.5). |
currency | – | No | ISO 4217 currency code, e.g. DKK or EUR. Without it, the store's settlement currency is used. |
coupon | – | No | The customer's discount code(s) as text, separated by commas (e.g. ANNA10,SUMMER). In a JSON body you can also send coupons as a list. |
Legacy direct links without a click ID can send aff (or aff_id) – the affiliate's tracking ID – together with store instead. The affiliate must then have joined the store's program, otherwise the response is not_joined.
GET
Parameters in the URL. Older versions of track.js use it, and the current one only in very old browsers without both fetch and sendBeacon. The order number and amount end up in the URL and therefore in access logs – prefer POST.
curl "https://app.affilyflow.com/api/track/conversion?afid=c_AbC123xYz_-9&store=DIN_BUTIK&order=1008&total=499¤cy=DKK"POST
Send the fields as JSON in the body. The fields can also be in the URL – if a field is in both, the body wins. The body is read as JSON whatever the Content-Type, so it can also be sent as text/plain. That is how track.js sends: a POST with fetch and keepalive, the body as text, so the browser doesn't need a CORS preflight first. The response is read, and on a 5xx, 429 or a network error the script sends the sale again later – see Getting the sale through.
curl -X POST https://app.affilyflow.com/api/track/conversion \
-H "Content-Type: application/json" \
-d '{"afid":"c_AbC123xYz_-9","store":"DIN_BUTIK","order":"1008","total":499,"currency":"DKK"}'await fetch('https://app.affilyflow.com/api/track/conversion', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
afid: order.afClick, // saved from the af_click cookie
store: 'DIN_BUTIK',
order: order.number,
total: order.subtotalExVat, // goods after discount, excl. VAT and shipping
currency: order.currency
})
});The body may be at most 64 KB.
Optional body fields
| Field | Meaning |
|---|---|
items | Item lines: a list of { title, variant, qty, price, product_id } and optionally sku, category (e.g. "Men > Shoes"), categories, brand and line_total (the line amount after discounts). title is required per line. At most 50 lines; long text is truncated. Category, brand and product are used for commission by category. |
subtotal, tax, shipping | The order breakdown (numbers, 0 or above). See below. |
buyer_hash | Fingerprint of the buyer's email: hex(sha256(lowercase(trim(email)))) – 64 hex characters. If it matches the affiliate's email, the sale is recorded as rejected (self_referral). The email itself is never sent. |
buyer_hash_n | The same fingerprint of the normalised email (Gmail dots and +tag removed) – 64 hex characters. See Buyer fingerprint. |
coupons | The customer's discount codes as a list of strings, e.g. ["ANNA10"]. See Personal discount codes. |
source | Where the sale comes from. Send "server" when your own server reports the sale. It is only stored as server when the call also carries the store's key (Authorization: Bearer afs_…) for the same store – otherwise as server-open. The sale is recorded the same way in both cases. |
The breakdown: if you send total as the order's full amount and include subtotal, commission is calculated on subtotal instead – but never on more than total:
- If
taxis 0 or missing, orsubtotal + shipping + tax = total(VAT added on top), the base issubtotal. - If
subtotal + shipping = total(VAT included in prices), the base issubtotal × (total − tax) / total. - Otherwise the cautious
min(subtotal, total − tax − shipping)is used.
The simplest is to send total as the goods amount excluding VAT and shipping and leave out the breakdown.
For the Google Analytics route, track.js also sends src=ga4 and the event's raw figures – gv (value), gs (shipping), gi (item lines' sum) and gt (tax) – so the server can recalculate the amount with the store's setting. Don't send them yourself; only sales marked src=ga4 are recalculated.
track.js also sends two fields you shouldn't send yourself:
ln– last click wins: another affiliate network had the customer's most recent click. No sale is recorded – no commission and no fee – only that we stepped back. The response isother_network_last_click.retry– the sale is sent again after an error (1 or 2). It is only stored on the event, so aduplicateafter a retry can be told apart from a real duplicate.
Reporting from your server
Report the sale from your backend once the order is paid:
- At checkout – while it is the customer's own browser calling you – save the value of the
af_clickcookie on the order. - When the order is paid – e.g. in the payment callback or webhook – report the order to the store API with a key.
The browser report (the script or the sale line) can stay as a backup: the same order number only counts once, and when the server reports the same order with the key, the sale shows as Confirmed by server. The store dashboard's Setup and Server-side tracking have ready-made snippets for Laravel, PHP, Node.js and Next.js.
If your server already posts to this endpoint with source: "server", the sale is still recorded. But the endpoint is open and anyone can send source, so without a key the source is stored as server-open and doesn't count as proof that your server reports the sales. If you send the key in Authorization: Bearer afs_… for the same store, the source is stored as server and the sale is marked as Confirmed by server – but only the new API has idempotency, order time, refunds and status.
The WooCommerce plugin (from 1.9.0) sends the store's plugin key with every sale. So its sales also show as Confirmed by server. Older plugin versions without the key keep working, but their sales don't get the badge.
Personal discount codes
A personal discount code is a code the store has assigned to one affiliate under Program → Discount codes in the store dashboard. Send the customer's codes in coupon (text) or coupons (list):
- Valid click: the click decides the sale, as always. A valid click always wins over a code.
- No click, or the click has expired or is unknown: if one of the codes is personal, the sale is attributed to the affiliate the code belongs to.
storemust be included. - No personal code: nothing is recorded, and the response is
no_coupon. A general code for all affiliates earns no commission on its own.
Codes are compared without spaces and in upper case. At most 10 codes per sale are used. Commission for a sale via a code is the program's current rate – there is no click to lock it on. All other guards apply as for a click.
curl -X POST https://app.affilyflow.com/api/track/conversion \
-H "Content-Type: application/json" \
-d '{"source":"server","store":"DIN_BUTIK","order":"1008","total":499,"currency":"DKK","coupons":["ANNA10"]}'Buyer fingerprint
Affiliates may not earn commission on their own purchases. To catch it, Affilyflow compares the buyer with the affiliate behind the click – but the email itself never leaves the store. The integration only sends one-way fingerprints:
| Field | How it is computed |
|---|---|
buyer_hash | hex(sha256(lowercase(trim(email)))) |
buyer_hash_n | hex(sha256(normalised email)) – optional, recommended |
The normalised email catches the same mailbox written differently, e.g. a.b+shop@gmail.com and ab@gmail.com:
- Remove leading and trailing spaces, and convert to lower case.
- Split the address at the last
@into a local part and a domain. - Cut the local part at the first
+. - If the domain is
gmail.comorgooglemail.com: remove every.from the local part, and set the domain togmail.com. buyer_hash_n= sha256 oflocalpart@domainas 64 lower-case hex characters.
If there is no @, or the local part or the domain is empty, no buyer_hash_n is sent. Send both fields – buyer_hash as before, so older integrations keep working unchanged. The fingerprints are not stored; they are only used for the comparison.
| Normalised | |
|---|---|
A.B+Shop@Gmail.com | ab@gmail.com |
a.b@googlemail.com | ab@gmail.com |
Anna.Hansen+news@Outlook.dk | anna.hansen@outlook.dk |
The snippets in Server-side tracking compute both. The WooCommerce plugin sends both from version 1.13.0, the Magento module from 1.1.0.
Responses
The response is always JSON with a status. What each status means and what to do is in Status codes.
| HTTP | Body | When |
|---|---|---|
| 200 | { "status": "ok" } | The sale is recorded. |
| 200 | { "status": "duplicate" }, "expired" etc. | The request was processed, but the sale earned no commission. |
| 200 | { "status": "no_coupon" } | No valid click, and none of the codes is a personal code. Nothing is recorded. |
| 200 | { "status": "other_network_last_click" } | The call had ln: another network had the customer's most recent click. No sale, no commission, no fee. |
| 404 | { "status": "unknown" } | The click ID doesn't exist. |
| 400 | { "status": "error", "reason": "…" } | Neither afid, aff + store nor a discount code + store was included. |
| 413 | { "status": "too_large" } | The body was over 64 KB. |
| 429 | { "status": "rate_limited" } | Too many calls from the same IP address. |
| 500 | { "status": "error" } | Recording failed. Try again. |
A recorded sale awaits the store's approval. Commission is only credited once the sale is approved.
Duplicates and order numbers
- The same order number in the same program is never counted twice – the second call responds
duplicate. It is therefore safe to resend when in doubt. - Without an order number there is no duplicate check on the server. Always send the order number.
- An unfilled placeholder (
DIN_ORDRE_ID,ORDER_ID,{{ … }},[ … ],< … >,% … %etc.) is treated as no order number, so it never takes up the number for every later sale.
Currency
The sale can be in any currency with a rate from the European Central Bank. It is converted to the store's settlement currency before commission and fee are calculated, and the rate is locked on the sale. A currency code that isn't three letters, or a currency without a rate from the last 10 days, is rejected as unsupported_currency.
Limits
- The endpoint is rate limited per IP address. The limit doesn't affect a store's own server in normal use; the response is
429withrate_limitedif it is reached. - Each program has an amount cap per order (50,000 in the settlement currency by default). An order above the cap is not rejected: the sale is recorded as pending and held until Affilyflow has checked the amount (the response has
held: "over_value_cap"). Neither the affiliate nor the store is notified before it is checked – usually it is an amount sent in cents. - Long values are truncated rather than rejected: click ID 64 characters, store and order number 120 characters.
Refunds
The open endpoint only reports sales. Refunds – full and partial – are reported with the store API with a key. The WooCommerce plugin and the Stripe webhook report refunds on their own, and the store can always reject a sale under Sales in the dashboard within the program's approval period – see Approval and refunds.
The store API (with a key)
For your own server. The calls are authenticated with the store's API key, so a sale from here shows as Confirmed by server to you and to Affilyflow – it cannot have been sent from a browser. All the rules for a sale (cookie period, maximum order value, blocked affiliates, program rules, self-referral, currency, duplicates and personal discount codes) are the same as for the open endpoint.
GET https://app.affilyflow.com/api/v1/store/ping
POST https://app.affilyflow.com/api/v1/store/conversions
GET https://app.affilyflow.com/api/v1/store/conversions/{order}
POST https://app.affilyflow.com/api/v1/store/conversions/{order}/refunds
POST https://app.affilyflow.com/api/v1/store/leads
GET https://app.affilyflow.com/api/v1/store/leads/{lead_id}
POST https://app.affilyflow.com/api/v1/store/leads/{lead_id}/reject
POST https://app.affilyflow.com/api/v1/store/leads/{lead_id}/qualifyLeads, sales after a lead and subscriptions have their own page with examples: Leads and subscriptions.
The key
- Create a key under Settings → API keys in the store dashboard. It is shown once; we only store a fingerprint of it. A store can have up to 5 active keys, and a key can be revoked at any time.
- Send it in
Authorization: Bearer afs_…(orX-Api-Key: afs_…). A key for one store decides the store by itself – you don't need to sendstore. If you have several stores, one key can cover them all – see One key for several stores. - The key belongs on your server only. The endpoints have no CORS, so a browser cannot call them. Keep it in an environment variable such as
AFFILYFLOW_API_KEY, never in code or in git.
curl https://app.affilyflow.com/api/v1/store/ping \
-H "Authorization: Bearer $AFFILYFLOW_API_KEY"The answer is the store and the key: { "ok": true, "store": { "slug": "…", "name": "…", "billing_currency": "DKK" }, "key": { "name": "…", "prefix": "afs_…", "scope": "store" } }.
One key for several stores
If your server reports sales for several stores, the owner can give a key the scope All your stores – when the key is created, or later with Use for all stores on the key under Settings → API keys. It is the same key, so the server does not need a new one. The key works for every store the owner owns – including stores added later – and never for anyone else's stores.
The store is found like this, in this order:
- The store you name. Send
storein the body,?store=in the URL or the headerAffilyflow-Store. The value can be the store's ID, slug or domain –maxipro.dk,www.maxipro.dkandhttps://maxipro.dk/cartare the same. - The click. A sale or lead with
afidbelongs to the click's store. Most sales therefore need nothing extra. - The order number. Lookups and refunds (
/conversions/{order},/leads/{lead_id}) find the store from the order number. If the number exists in more than one of your stores, the answer is409 store_ambiguous– sendstore. - Only one store. If you only own one store, it is that one.
A sale without a click – e.g. only with a personal discount code, or "test": true without afid – must include store. Otherwise the answer is 400 store_required with the key's stores in stores.
curl https://app.affilyflow.com/api/v1/store/conversions \
-H "Authorization: Bearer $AFFILYFLOW_API_KEY" \
-H "Idempotency-Key: 10045" \
-H "Content-Type: application/json" \
-d '{ "store": "maxipro.dk", "order": "10045", "total": 499.00, "currency": "DKK", "coupons": ["SOFIE10"] }'ping with an account key also answers with every store the key covers: "key": { "scope": "account", … }, "stores": [{ "slug": "…", "name": "…", "domain": "maxipro.dk" }, …]. If you send store, store in the answer is that store.
Report a sale
curl -X POST https://app.affilyflow.com/api/v1/store/conversions \
-H "Authorization: Bearer $AFFILYFLOW_API_KEY" \
-H "Idempotency-Key: 1008" \
-H "Content-Type: application/json" \
-d '{"order":"1008","total":499,"currency":"DKK","afid":"c_AbC123xYz_-9","order_time":"2026-10-21T14:03:00Z"}'| Field | Required | Meaning |
|---|---|---|
order | Yes | The order number, at most 120 characters. The same number is never counted twice in the same program. An unfilled placeholder is rejected. |
total | Yes | The amount commission is calculated from: the goods after discount, excluding VAT and shipping. A number or a machine number as text ("1249.50") – "1.249,00" is rejected with invalid_total instead of becoming 0. |
currency | Yes | ISO 4217 currency code, e.g. DKK, EUR or SEK. |
afid | When there is a click | The click ID (c_…). Alias: click_id. |
coupons | No | The customer's discount codes as a list (or coupon as text). Without a valid click, a personal discount code attributes the sale. |
order_total | No | What the customer paid (with VAT and shipping). It is then stored as the order's amount, and total is the base. total cannot be larger – otherwise 400 invalid_total. |
order_time | Recommended | When the order was placed (ISO 8601). The cookie period is measured from it instead of from the time of the call, so a sale reported later does not fall out of the period. At most 180 days old and not in the future, and the click must have happened before the order. The limit only guards against integration errors – whether the sale earns commission is decided by the program's cookie period, measured from the click to order_time. |
buyer_hash | Recommended | hex(sha256(lowercase(trim(email)))). Used only to reject self-referrals. |
buyer_hash_n | Recommended | The fingerprint of the normalised email, see Buyer fingerprint. |
items | No | Line items: { title, variant, qty, price, product_id } and optionally sku, category, categories, brand, line_total, at most 50. See Commission by category. |
lead_id | No | Lead programs with Lead and sale or Sale only only: the lead the sale follows. The click then doesn't have to be sent again. See Lead and sale. |
subscription_id | No | Your own ID for the subscription (at most 120 characters) – on the first payment and on every renewal. See Subscriptions from your server. |
renewal | No | true = a renewal of the subscription in subscription_id. No click is needed; the affiliate is the one who got the first payment. |
period | No | The period the payment covers, e.g. "2026-11" (at most 40 characters). The same period counts only once per subscription. |
test | No | true = a test sale, see Test mode. |
The body may be at most 64 KB.
Responses:
| HTTP | status | When |
|---|---|---|
| 201 | ok | The sale is recorded and confirmed. |
| 201 | self_referral, rule_breach | The sale is recorded but rejected with a reason (self-referral or a certain rule breach). |
| 200 | confirmed | The browser had already reported the order – now it is confirmed by your server. |
| 200 | duplicate | The order is already reported and confirmed. |
| 422 | expired, unknown, click_after_order, invalid_order_time, order_time_too_old, no_coupon, missing_attribution, store_mismatch, not_joined, unsupported_currency, program_inactive, store_inactive, suspended, blocked, zero_value, stale_lead_trigger, lead_not_found, lead_rejected, lead_only_program, not_recurring, cap_reached, first_rejected, unknown_subscription, duplicate_period, subscription_exists | The sale earned no commission and is not recorded. The response has status, recorded: false and error.code with the same code. See Status codes. |
A 200 or 201 response includes the sale as GET shows it:
{
"status": "ok",
"recorded": true,
"confirmed_by_server": true,
"test": false,
"conversion": {
"order": "1008", "status": "pending", "currency": "DKK",
"order_value": 499, "commission_base": 499, "commission": 62.38, "network_fee": 15.6,
"approval_due_at": "2026-11-20T14:03:12Z", "attribution": "click",
"confirmed_by_server": true, "refunds": []
}
}A recorded renewal ("renewal": true) also has cycle – which payment of the subscription it is – and cap, the cap from the click.
Idempotency
Send Idempotency-Key with every POST – the order number is a good choice. The same key and the same body within 24 hours returns exactly the same response again (with the header Idempotent-Replayed: true) and records nothing new. Retrying after a timeout is therefore safe.
- Only
200and201responses are remembered. An error (4xxand5xx) is not remembered: fix the call and send it again with the same key. This cannot count anything twice: an error response recorded nothing, the same order number is only counted once (duplicate), and a full refund or a partial one with the samerefund_idis only counted once (already_rejectedoralready_applied). - The same key with a different body is rejected with
422 idempotency_key_reusedwhen the key already gave a200or201response, or while a call with it is still running. - If a call with the same key is still running, the answer is
409 idempotency_in_progress– retry in a moment. - Without
Idempotency-Key, the order number still protects against double sales (duplicate).
Retry automatically on network errors, 429 and 5xx – with the same Idempotency-Key and with pauses in between (e.g. 1, 2 and 4 seconds). Don't retry other 4xx automatically: the same call gives the same error. Fix the call – or wait until the cause is gone, e.g. the program is switched back on – and send it again with the same key.
Test mode
With "test": true a test sale is recorded on the store's test link – even without a click. It shows with a test badge in the dashboard, costs nothing, is never paid out and is not counted anywhere. The click ID and discount codes are ignored, and the order number is stored separately, so a test order number never takes up a real one. Look the test sale up with GET …/conversions/{order}?test=true, and refund it with "test": true in the body.
The real test flow – the test link, a purchase and the sale from your server with the test click's afid – works too and shows the whole chain in the live test in Setup.
Look up a sale
curl https://app.affilyflow.com/api/v1/store/conversions/1008 \
-H "Authorization: Bearer $AFFILYFLOW_API_KEY"The answer is { "conversion": { … } } with the status (pending, approved, paid or rejected), the rejection reason, the amounts in the settlement currency, the original amount and rate for another currency, when the approval period ends, whether the sale is confirmed by server, and every refund. An unknown order number gives 404 not_found. URL-encode the order number if it contains /, # or spaces.
Refunds from your server
curl -X POST https://app.affilyflow.com/api/v1/store/conversions/1008/refunds \
-H "Authorization: Bearer $AFFILYFLOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{"reason":"Order cancelled"}'curl -X POST https://app.affilyflow.com/api/v1/store/conversions/1008/refunds \
-H "Authorization: Bearer $AFFILYFLOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{"refund_id":"R-55","amount":150,"total":623.75,"currency":"DKK"}'| Field | Meaning |
|---|---|
amount | The refunded amount. Leave it out to reject the whole sale, as when the store rejects it in the dashboard. |
total | The order total on the same basis as amount (e.g. both with VAT), so the share is amount / total. Without it, the share is taken of the sale's amount. |
base | The refunded part of the commission base (goods without VAT and shipping), when you know it. The reduction is then exact. |
currency | The refund's currency. Without it, the sale's own currency is used; another currency is converted with the sale's locked rate. |
refund_id | Your ID for the refund. The same ID is only counted once (already_applied). Always send it for partial refunds. |
reason | The reason the affiliate and the store see. At most 300 characters. |
test | true to refund a test sale. |
A partial refund reduces commission and fee proportionally; when the refunds cover the whole order, the sale is rejected. A fixed amount per sale is not changed by a partial refund, and leads can only be rejected in full – a lead from your server is rejected with POST /leads/{lead_id}/reject. A subscription renewal is its own sale and is refunded with its own order number. The rules are the same as in Approval and refunds. The answer is 200 with status (ok, already_applied or already_rejected), full and the sale after the refund; an unknown order number gives 404 not_found.
Errors
All errors have the same shape, and code is what your code should react to (the message is in English and may change):
{ "error": { "code": "invalid_total", "message": "\"total\" must be a number of 0 or more with a decimal point, e.g. 1249.50." } }400 means the call is malformed. 422 means the call was well-formed, but the sale, lead or refund didn't go through. An error is not remembered under Idempotency-Key, so fix the call and send it again with the same key.
All endpoints
| HTTP | code | When |
|---|---|---|
| 401 | missing_key | No key in Authorization: Bearer afs_… or X-Api-Key. |
| 401 | invalid_key | The key is invalid or revoked. |
| 400 | invalid_json | POST only: the body is not a JSON object. |
| 400 | invalid_idempotency_key | POST only: Idempotency-Key is not 1–255 printable ASCII characters. |
| 409 | idempotency_in_progress | A call with the same Idempotency-Key is still running. Retry in a moment. |
| 413 | too_large | The body was over 64 KB. |
| 422 | idempotency_key_reused | The key gave a 200 or 201 response within the last 24 hours – or a call with it is still running – but with a different body. Send the original body – or use a new key. |
| 429 | rate_limited | Too many calls with the key – or too many attempts with a wrong key from the same IP address. Wait the number of seconds Retry-After says. |
| 500 | server_error | An error on our side. Retry with the same Idempotency-Key. |
| 503 | not_ready, unavailable | The API is temporarily unavailable. Retry after Retry-After. |
| 400 | store_required | Only a key for several stores: the store could not be found from the click or the order number. Send store (ID, slug or domain). The answer lists the key's stores in stores. |
| 404 | store_not_found | The key does not cover the store you sent in store. |
| 409 | store_ambiguous | The order number exists in more than one of the key's stores. Send store. |
| 422 | store_mismatch | The click (afid) belongs to a store the key does not cover. |
| 403 | no_stores | The owner behind the key no longer owns any store. Create a new key. |
Report a sale – POST /conversions
| HTTP | code | When |
|---|---|---|
| 400 | missing_order, invalid_order | order is missing, longer than 120 characters or an unfilled placeholder. |
| 400 | missing_total, invalid_total | total is missing, not a number of 0 or more – or larger than order_total. |
| 400 | invalid_order_total | order_total is not a number of 0 or more. |
| 400 | missing_currency, invalid_currency | currency is missing or not three letters. |
| 400 | invalid_click_id | afid doesn't look like a click ID: c_ followed by 4–64 letters, digits, _ or -. |
| 400 | invalid_buyer_hash | buyer_hash is not 64 hex characters. |
| 400 | invalid_buyer_hash_n | buyer_hash_n is not 64 hex characters. |
| 400 | invalid_order_time | order_time is not an ISO 8601 time. |
| 400 | invalid_test | test is neither true nor false. |
| 400 | invalid_lead_id | lead_id is over 100 characters, has spaces or non-ASCII characters, looks like a placeholder or an email address – or was sent on a renewal. |
| 400 | invalid_subscription_id, missing_subscription_id | subscription_id is over 120 characters or invalid – or missing on a renewal. |
| 400 | invalid_renewal | renewal is neither true nor false. |
| 400 | invalid_period | period is over 40 characters. |
| 422 | expired, unknown, click_after_order, invalid_order_time, order_time_too_old, no_coupon, missing_attribution, store_mismatch, not_joined, unsupported_currency, program_inactive, store_inactive, suspended, blocked, zero_value, stale_lead_trigger, lead_not_found, lead_rejected, lead_only_program, not_recurring, cap_reached, first_rejected, unknown_subscription, duplicate_period, subscription_exists | The sale earned no commission and is not recorded. invalid_order_time as 422 means the time is in the future. See Status codes. |
Look up a sale – GET /conversions/{order}
| HTTP | code | When |
|---|---|---|
| 400 | missing_order, invalid_order | The order number in the URL is missing, longer than 120 characters or an unfilled placeholder. |
| 404 | not_found | No sale with that order number in your store (with ?test=true: no test sale). |
Leads – POST /leads, GET /leads/{lead_id}, POST /leads/{lead_id}/reject and POST /leads/{lead_id}/qualify
| HTTP | code | When |
|---|---|---|
| 400 | missing_lead_id, invalid_lead_id | lead_id is missing, over 100 characters, has spaces or non-ASCII characters, or looks like a placeholder or an email address. |
| 400 | invalid_value, invalid_currency | value isn't a number of 0 or more, or currency isn't three letters. |
| 400 | invalid_click_id, invalid_buyer_hash, invalid_buyer_hash_n | As for sales. |
| 400 | invalid_occurred_at | occurred_at isn't an ISO 8601 time. |
| 400 | invalid_code, invalid_reason, missing_reason | reject only: an unknown code, a reason over 300 characters – or code other without a reason of at least 3 characters. |
| 404 | not_found | No lead with that lead_id in your store (with "test": true: no test lead). |
| 409 | already_reviewed | reject only: the lead is already approved. |
| 409 | already_rejected | qualify only: the lead is rejected and can't be qualified. |
| 422 | not_lead_program, lead_per_click | The program pays per sale – or the click already has a lead, and the program only allows one. See Status codes. |
| 422 | held_by_affilyflow, reject_window | reject only: Affilyflow is reviewing the lead – or the approval period is over. |
| 422 | expired, unknown, click_after_order, invalid_order_time, order_time_too_old, no_coupon, missing_attribution and others | As for sales: the lead earned no commission and is not recorded. |
Refunds – POST /conversions/{order}/refunds
| HTTP | code | When |
|---|---|---|
| 400 | missing_order, invalid_order | The order number in the URL is missing, longer than 120 characters or an unfilled placeholder. |
| 400 | missing_amount | total or base was sent without amount. Leave all three out to refund the whole sale. |
| 400 | invalid_amount | amount is not a number above 0. |
| 400 | invalid_total | total is not a number above 0. |
| 400 | invalid_base | base is not a number of 0 or more. |
| 400 | invalid_currency | currency is not three letters. |
| 400 | invalid_refund_id | refund_id is longer than 120 characters. |
| 400 | invalid_test | test is neither true nor false. |
| 404 | not_found | No sale with that order number in your store (with "test": true: no test sale). |
| 422 | not_applicable | A lead cannot be partly refunded. Leave out amount to reject the lead. |
| 422 | currency_mismatch | The refund currency is neither the sale's settlement currency nor the currency the customer paid in. |
| 422 | zero_value | The sale has no order value to take a share of. Send total. |
See also Custom-built store and Testing and troubleshooting.
Missing something?
Write to us – we answer quickly, and the page gets fixed.