Conversion API

The endpoint that receives sales – for server-side and custom integrations, with parameters, responses and limits.

View as Markdown

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.

EndpointHTTP
POST https://app.affilyflow.com/api/track/conversion
GET  https://app.affilyflow.com/api/track/conversion
  • Both GET and POST work. OPTIONS answers 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

ParameterAliasRequiredMeaning
afidclick_idYes, when there is a clickThe click ID (c_…). Without a click, a personal discount code in coupon/coupons can attribute the sale.
store–RecommendedYour store ID (the same as data-store). Must match the click's store, otherwise store_mismatch.
orderorder_idRecommendedThe order number. The same number is never counted twice in the same program. At most 120 characters.
totalorder_totalYesThe amount commission is calculated on: goods after discount, excluding VAT and shipping. A machine number (1249.5).
currency–NoISO 4217 currency code, e.g. DKK or EUR. Without it, the store's settlement currency is used.
coupon–NoThe 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.

GETShell
curl "https://app.affilyflow.com/api/track/conversion?afid=c_AbC123xYz_-9&store=DIN_BUTIK&order=1008&total=499&currency=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.

POST with JSONShell
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"}'
Node · after paymentJavaScript
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

FieldMeaning
itemsItem 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, shippingThe order breakdown (numbers, 0 or above). See below.
buyer_hashFingerprint 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_nThe same fingerprint of the normalised email (Gmail dots and +tag removed) – 64 hex characters. See Buyer fingerprint.
couponsThe customer's discount codes as a list of strings, e.g. ["ANNA10"]. See Personal discount codes.
sourceWhere 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 tax is 0 or missing, or subtotal + shipping + tax = total (VAT added on top), the base is subtotal.
  • If subtotal + shipping = total (VAT included in prices), the base is subtotal × (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 is other_network_last_click.
  • retry – the sale is sent again after an error (1 or 2). It is only stored on the event, so a duplicate after 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:

  1. At checkout – while it is the customer's own browser calling you – save the value of the af_click cookie on the order.
  2. 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. store must 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.

POST · personal discount code without a clickShell
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:

FieldHow it is computed
buyer_hashhex(sha256(lowercase(trim(email))))
buyer_hash_nhex(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:

  1. Remove leading and trailing spaces, and convert to lower case.
  2. Split the address at the last @ into a local part and a domain.
  3. Cut the local part at the first +.
  4. If the domain is gmail.com or googlemail.com: remove every . from the local part, and set the domain to gmail.com.
  5. buyer_hash_n = sha256 of localpart@domain as 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.

EmailNormalised
A.B+Shop@Gmail.com ab@gmail.com
a.b@googlemail.comab@gmail.com
Anna.Hansen+news@Outlook.dkanna.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.

HTTPBodyWhen
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 429 with rate_limited if 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.

EndpointsHTTP
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}/qualify

Leads, 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_… (or X-Api-Key: afs_…). A key for one store decides the store by itself – you don't need to send store. 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.
Try the keyShell
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:

  1. The store you name. Send store in the body, ?store= in the URL or the header Affilyflow-Store. The value can be the store's ID, slug or domain – maxipro.dk, www.maxipro.dk and https://maxipro.dk/cart are the same.
  2. The click. A sale or lead with afid belongs to the click's store. Most sales therefore need nothing extra.
  3. 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 is 409 store_ambiguous – send store.
  4. 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.

Sale with a discount code for a specific storeShell
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

POST /api/v1/store/conversionsShell
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"}'
FieldRequiredMeaning
orderYesThe order number, at most 120 characters. The same number is never counted twice in the same program. An unfilled placeholder is rejected.
totalYesThe 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.
currencyYesISO 4217 currency code, e.g. DKK, EUR or SEK.
afidWhen there is a clickThe click ID (c_…). Alias: click_id.
couponsNoThe customer's discount codes as a list (or coupon as text). Without a valid click, a personal discount code attributes the sale.
order_totalNoWhat 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_timeRecommendedWhen 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_hashRecommendedhex(sha256(lowercase(trim(email)))). Used only to reject self-referrals.
buyer_hash_nRecommendedThe fingerprint of the normalised email, see Buyer fingerprint.
itemsNoLine items: { title, variant, qty, price, product_id } and optionally sku, category, categories, brand, line_total, at most 50. See Commission by category.
lead_idNoLead 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_idNoYour own ID for the subscription (at most 120 characters) – on the first payment and on every renewal. See Subscriptions from your server.
renewalNotrue = a renewal of the subscription in subscription_id. No click is needed; the affiliate is the one who got the first payment.
periodNoThe period the payment covers, e.g. "2026-11" (at most 40 characters). The same period counts only once per subscription.
testNotrue = a test sale, see Test mode.

The body may be at most 64 KB.

Responses:

HTTPstatusWhen
201okThe sale is recorded and confirmed.
201self_referral, rule_breachThe sale is recorded but rejected with a reason (self-referral or a certain rule breach).
200confirmedThe browser had already reported the order – now it is confirmed by your server.
200duplicateThe order is already reported and confirmed.
422expired, 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_existsThe 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:

201JSON
{
  "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 200 and 201 responses are remembered. An error (4xx and 5xx) 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 same refund_id is only counted once (already_rejected or already_applied).
  • The same key with a different body is rejected with 422 idempotency_key_reused when the key already gave a 200 or 201 response, 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

GET /api/v1/store/conversions/{order}Shell
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

Full refundShell
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"}'
Partial refundShell
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"}'
FieldMeaning
amountThe refunded amount. Leave it out to reject the whole sale, as when the store rejects it in the dashboard.
totalThe 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.
baseThe refunded part of the commission base (goods without VAT and shipping), when you know it. The reduction is then exact.
currencyThe refund's currency. Without it, the sale's own currency is used; another currency is converted with the sale's locked rate.
refund_idYour ID for the refund. The same ID is only counted once (already_applied). Always send it for partial refunds.
reasonThe reason the affiliate and the store see. At most 300 characters.
testtrue 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):

ErrorJSON
{ "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

HTTPcodeWhen
401missing_keyNo key in Authorization: Bearer afs_… or X-Api-Key.
401invalid_keyThe key is invalid or revoked.
400invalid_jsonPOST only: the body is not a JSON object.
400invalid_idempotency_keyPOST only: Idempotency-Key is not 1–255 printable ASCII characters.
409idempotency_in_progressA call with the same Idempotency-Key is still running. Retry in a moment.
413too_largeThe body was over 64 KB.
422idempotency_key_reusedThe 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.
429rate_limitedToo 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.
500server_errorAn error on our side. Retry with the same Idempotency-Key.
503not_ready, unavailableThe API is temporarily unavailable. Retry after Retry-After.
400store_requiredOnly 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.
404store_not_foundThe key does not cover the store you sent in store.
409store_ambiguousThe order number exists in more than one of the key's stores. Send store.
422store_mismatchThe click (afid) belongs to a store the key does not cover.
403no_storesThe owner behind the key no longer owns any store. Create a new key.

Report a sale – POST /conversions

HTTPcodeWhen
400missing_order, invalid_orderorder is missing, longer than 120 characters or an unfilled placeholder.
400missing_total, invalid_totaltotal is missing, not a number of 0 or more – or larger than order_total.
400invalid_order_totalorder_total is not a number of 0 or more.
400missing_currency, invalid_currencycurrency is missing or not three letters.
400invalid_click_idafid doesn't look like a click ID: c_ followed by 4–64 letters, digits, _ or -.
400invalid_buyer_hashbuyer_hash is not 64 hex characters.
400invalid_buyer_hash_nbuyer_hash_n is not 64 hex characters.
400invalid_order_timeorder_time is not an ISO 8601 time.
400invalid_testtest is neither true nor false.
400invalid_lead_idlead_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.
400invalid_subscription_id, missing_subscription_idsubscription_id is over 120 characters or invalid – or missing on a renewal.
400invalid_renewalrenewal is neither true nor false.
400invalid_periodperiod is over 40 characters.
422expired, 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_existsThe 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}

HTTPcodeWhen
400missing_order, invalid_orderThe order number in the URL is missing, longer than 120 characters or an unfilled placeholder.
404not_foundNo 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

HTTPcodeWhen
400missing_lead_id, invalid_lead_idlead_id is missing, over 100 characters, has spaces or non-ASCII characters, or looks like a placeholder or an email address.
400invalid_value, invalid_currencyvalue isn't a number of 0 or more, or currency isn't three letters.
400invalid_click_id, invalid_buyer_hash, invalid_buyer_hash_nAs for sales.
400invalid_occurred_atoccurred_at isn't an ISO 8601 time.
400invalid_code, invalid_reason, missing_reasonreject only: an unknown code, a reason over 300 characters – or code other without a reason of at least 3 characters.
404not_foundNo lead with that lead_id in your store (with "test": true: no test lead).
409already_reviewedreject only: the lead is already approved.
409already_rejectedqualify only: the lead is rejected and can't be qualified.
422not_lead_program, lead_per_clickThe program pays per sale – or the click already has a lead, and the program only allows one. See Status codes.
422held_by_affilyflow, reject_windowreject only: Affilyflow is reviewing the lead – or the approval period is over.
422expired, unknown, click_after_order, invalid_order_time, order_time_too_old, no_coupon, missing_attribution and othersAs for sales: the lead earned no commission and is not recorded.

Refunds – POST /conversions/{order}/refunds

HTTPcodeWhen
400missing_order, invalid_orderThe order number in the URL is missing, longer than 120 characters or an unfilled placeholder.
400missing_amounttotal or base was sent without amount. Leave all three out to refund the whole sale.
400invalid_amountamount is not a number above 0.
400invalid_totaltotal is not a number above 0.
400invalid_basebase is not a number of 0 or more.
400invalid_currencycurrency is not three letters.
400invalid_refund_idrefund_id is longer than 120 characters.
400invalid_testtest is neither true nor false.
404not_foundNo sale with that order number in your store (with "test": true: no test sale).
422not_applicableA lead cannot be partly refunded. Leave out amount to reject the lead.
422currency_mismatchThe refund currency is neither the sale's settlement currency nor the currency the customer paid in.
422zero_valueThe 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.

Contact support