Every response is JSON with ok and a machine-readable reason, for example {"ok": true, "reason": "recorded", "transaction_id": 123}. Created records add transaction_id, conversion_id, binding_id, event_id, or membership_id. Branch on the status and reason, never on wording.
| Status | Meaning |
|---|---|
| 200 | Accepted, including an exact replay of an earlier request (for example duplicate_order). A free order answers zero_amount: accepted, nothing recorded, do not retry. Check ok and reason too: a reversal's conversion_not_found is a no-op, not a completed refund. A replayed recurring event returns the first delivery's reason and status with replayed: true. |
| 400 | The body is not valid JSON, has invalid amounts, uses unsupported Content-Encoding, or is missing a required field (invalid_payload, invalid_amounts, json_required, unexpected_click_id, unsupported_content_encoding). Send uncompressed JSON and fix the request before retrying. |
| 401 | Missing or wrong postback key. |
| 403 | The integration is disabled or the store is archived. |
| 404 | The customer, invoice, click or code named in a recurring request does not exist (unknown_referral_code for a code). |
| 409 | The same ID was sent earlier with different content (duplicate_order_conflict, duplicate_event_conflict, refund_amount_conflict), a recurring invoice already paid under another customer was sent again (duplicate_invoice_conflict), or the environment does not match. |
| 410 | A verification test link expired. |
| 413 | The body is larger than 16 KiB (2 MiB for the product catalog endpoint). |
| 422 | The request is valid but cannot earn, for example missing_referral_click, referral_click_already_converted, unsupported_pricing_currency, invalid_occurred_at, relationship_ended, or partial_refund_not_adjusted. Do not retry. pricing_history_ambiguous means the purchase time falls within the same second (or millisecond) as a change to your commission rules, so Refermate cannot tell which rates applied; resending the same body gets the same answer, so resend occurred_at with milliseconds or contact support. paid_conversion_not_auto_reversed means a refund came after the commission was billed, so contact support. |
| 423 | active_hold: the order is under a dispute or review hold, so the refund changed nothing. Resend the same body after the Retry-After delay (one day, also in retry_after_seconds); it succeeds once the hold resolves. |
| 429 | rate_limited: the integration's shared postback budget is exhausted. Keep the original body queued and retry after Retry-After: 60; no event was consumed. |
| 5xx | Usually temporary: retry the same body with bounded backoff. 503 rate_limit_unavailable means admission failed before body or event processing; pricing_history_unavailable means pricing history is briefly unavailable. |
referral_click_already_converted. Each click keeps the setting it was made under. A code backs any number of orders.occurred_at may be at most 5 minutes in the future. A paid order may be at most the program's attribution window plus 7 days old; refunds and subscription events may be up to 372 days old.Keep the original request bodies and retry counters in your backend. This example chooses the next action; it does not send requests or persist retry state.
function nextRefundDelivery({ refund, conversion, attempts, elapsedMs }) {
if (refund.ok) {
const completed = ["reversed", "partially_reversed", "duplicate_reversal", "not_commissioned"];
return { action: completed.includes(refund.reason) ? "complete" : "reconcile_and_alert" };
}
if (!["conversion_not_found", "invoice_not_found"].includes(refund.reason)) {
return { action: "handle_other_error" };
}
if (attempts >= 8 || elapsedMs >= 24 * 60 * 60 * 1000) {
return { action: "reconcile_and_alert" };
}
const accepted = conversion?.ok &&
(conversion.httpStatus === undefined ||
(conversion.httpStatus >= 200 && conversion.httpStatus < 300)) &&
["recorded", "duplicate_order", "duplicate_invoice"].includes(conversion.reason);
const httpStatus = conversion?.httpStatus;
const retryableConversion = httpStatus === 429 ||
(typeof httpStatus === "number" && httpStatus >= 500 && httpStatus < 600);
if (conversion && !accepted && (conversion.ok || !retryableConversion)) {
return { action: "reconcile_and_alert" };
}
const remainingRetryDelay = conversion?.retryAfterMs;
const retryAfterMs = !accepted && typeof remainingRetryDelay === "number" &&
Number.isFinite(remainingRetryDelay) && remainingRetryDelay > 0
? remainingRetryDelay : 0;
const delayMs = Math.max(
Math.min(60 * 1000 * 2 ** attempts, 60 * 60 * 1000), retryAfterMs);
if (elapsedMs + delayMs >= 24 * 60 * 60 * 1000) {
return { action: "reconcile_and_alert" };
}
return {
action: accepted ? "retry_stored_refund" : "deliver_stored_conversion",
delayMs,
};
}Every response is JSON with ok and a machine-readable reason, for example {"ok": true, "reason": "recorded", "transaction_id": 123}. Created records add transaction_id, conversion_id, binding_id, event_id, or membership_id. Branch on the status and reason, never on wording.
| Status | Meaning |
|---|---|
| 200 | Accepted, including an exact replay of an earlier request (for example duplicate_order). A free order answers zero_amount: accepted, nothing recorded, do not retry. Check ok and reason too: a reversal's conversion_not_found is a no-op, not a completed refund. A replayed recurring event returns the first delivery's reason and status with replayed: true. |
| 400 | The body is not valid JSON, has invalid amounts, uses unsupported Content-Encoding, or is missing a required field (invalid_payload, invalid_amounts, json_required, unexpected_click_id, unsupported_content_encoding). Send uncompressed JSON and fix the request before retrying. |
| 401 | Missing or wrong postback key. |
| 403 | The integration is disabled or the store is archived. |
| 404 | The customer, invoice, click or code named in a recurring request does not exist (unknown_referral_code for a code). |
| 409 | The same ID was sent earlier with different content (duplicate_order_conflict, duplicate_event_conflict, refund_amount_conflict), a recurring invoice already paid under another customer was sent again (duplicate_invoice_conflict), or the environment does not match. |
| 410 | A verification test link expired. |
| 413 | The body is larger than 16 KiB (2 MiB for the product catalog endpoint). |
| 422 | The request is valid but cannot earn, for example missing_referral_click, referral_click_already_converted, unsupported_pricing_currency, invalid_occurred_at, relationship_ended, or partial_refund_not_adjusted. Do not retry. pricing_history_ambiguous means the purchase time falls within the same second (or millisecond) as a change to your commission rules, so Refermate cannot tell which rates applied; resending the same body gets the same answer, so resend occurred_at with milliseconds or contact support. paid_conversion_not_auto_reversed means a refund came after the commission was billed, so contact support. |
| 423 | active_hold: the order is under a dispute or review hold, so the refund changed nothing. Resend the same body after the Retry-After delay (one day, also in retry_after_seconds); it succeeds once the hold resolves. |
| 429 | rate_limited: the integration's shared postback budget is exhausted. Keep the original body queued and retry after Retry-After: 60; no event was consumed. |
| 5xx | Usually temporary: retry the same body with bounded backoff. 503 rate_limit_unavailable means admission failed before body or event processing; pricing_history_unavailable means pricing history is briefly unavailable. |
referral_click_already_converted. Each click keeps the setting it was made under. A code backs any number of orders.occurred_at may be at most 5 minutes in the future. A paid order may be at most the program's attribution window plus 7 days old; refunds and subscription events may be up to 372 days old.Keep the original request bodies and retry counters in your backend. This example chooses the next action; it does not send requests or persist retry state.
function nextRefundDelivery({ refund, conversion, attempts, elapsedMs }) {
if (refund.ok) {
const completed = ["reversed", "partially_reversed", "duplicate_reversal", "not_commissioned"];
return { action: completed.includes(refund.reason) ? "complete" : "reconcile_and_alert" };
}
if (!["conversion_not_found", "invoice_not_found"].includes(refund.reason)) {
return { action: "handle_other_error" };
}
if (attempts >= 8 || elapsedMs >= 24 * 60 * 60 * 1000) {
return { action: "reconcile_and_alert" };
}
const accepted = conversion?.ok &&
(conversion.httpStatus === undefined ||
(conversion.httpStatus >= 200 && conversion.httpStatus < 300)) &&
["recorded", "duplicate_order", "duplicate_invoice"].includes(conversion.reason);
const httpStatus = conversion?.httpStatus;
const retryableConversion = httpStatus === 429 ||
(typeof httpStatus === "number" && httpStatus >= 500 && httpStatus < 600);
if (conversion && !accepted && (conversion.ok || !retryableConversion)) {
return { action: "reconcile_and_alert" };
}
const remainingRetryDelay = conversion?.retryAfterMs;
const retryAfterMs = !accepted && typeof remainingRetryDelay === "number" &&
Number.isFinite(remainingRetryDelay) && remainingRetryDelay > 0
? remainingRetryDelay : 0;
const delayMs = Math.max(
Math.min(60 * 1000 * 2 ** attempts, 60 * 60 * 1000), retryAfterMs);
if (elapsedMs + delayMs >= 24 * 60 * 60 * 1000) {
return { action: "reconcile_and_alert" };
}
return {
action: accepted ? "retry_stored_refund" : "deliver_stored_conversion",
delayMs,
};
}