{"object":"doc","slug":"handle-every-payment-state","title":"Handle every payment state","summary":"The payment state machine, every failure_code, and how to wait for a result without guessing.","tags":["guide","payments","states","errors"],"body":"# Handle every payment state\n\n```\npending ──► processing ──► succeeded\n   │             ├───────► failed\n   │             ├───────► canceled\n   └─────────────┴───────► expired\n```\n\n| state | Meaning | What you do |\n|---|---|---|\n| `pending` | Sent to the terminal, no card yet | Wait |\n| `processing` | Card presented, processor deciding | Wait |\n| `succeeded` | The payment succeeded; its refunded balance may have changed later | Verify ownership, reference, amount and current balance before an idempotent order update; show the appropriate receipt |\n| `failed` | Local payment ended; `failure_code` determines whether the processor outcome is known | A known decline may permit another approved attempt; unresolved processor results require review first |\n| `canceled` | Local payment was canceled | Preserve late-authorization/attention handling; do not infer that every later processor event is impossible |\n| `expired` | Local waiting period ended at `expires` (180 s) | Review any uncertainty/attention before authorizing another attempt |\n\nTerminal payments answer `202` with `pending` and finish later. Keyed payments answer `201` already final.\n\n`amount_refunded_cents` includes amounts reserved by pending refund/void operations as well as completed reversals. It is a balance-control field, not proof that a customer's refund completed. Inspect the related refund object's state for reversal progress, and preserve uncertainty rather than treating a changed balance as a new charge or a confirmed refund.\n\nA refund in state `failed` with `failure_code: processor_unverified` is not a refused refund. Its outcome at the processor is unknown and it may still reach the customer. Do not refund by other means (cash, the processor's portal, a void, or a new refund under a new key). Retry the same request with the same `Idempotency-Key`, or contact ZeroPoint support with the refund id; the refunds-and-voids guide lists which refund failure codes are final.\n\n## failure_code values\n\n| failure_code | On | Meaning |\n|---|---|---|\n| `card_declined` | terminal, keyed, card_on_file | Issuer declined. On a keyed payment, `processor_transaction_id` carries the processor's id for the declined attempt when the processor returned one, so you can find that row at the processor. It is not a charge: the payment is `failed` and cannot be refunded or voided |\n| `nonce_invalid` | keyed | Nonce expired or reused; get a fresh one |\n| `duplicate_transaction` | keyed, card_on_file | The processor's duplicate screen refused a second equal charge on the same card a short time after another. Not a card decline and no money moved. Do not ask for another card; check the earlier charge is the one you meant, and send a genuine second charge later as a new payment with a new reference |\n| `card_not_saved` | keyed with `save_payment_method` | The card could not be saved, so nothing was charged and `payment_method` is null. Ask the cardholder to enter the card again. See `save-a-card` |\n| `processor_rejected` | keyed, card_on_file | The processor refused the request itself as invalid (an HTTP 400 or 422 in its own error format) for a reason other than the nonce. Not a card decline, and no sale was taken. Another attempt needs a new nonce, a new key and a new reference; if it repeats, the merchant's setup is the likely cause, so send the payment id and the `request_id` to your ZeroPoint contact |\n| `processor_unverified` | keyed, card_on_file | The processor answered with a status we do not recognize, or never answered at all: a keyed payment still `pending` 15 minutes after creation is ended this way by our sweeper and fires `payment.failed`. The charge may or may not have been captured. `processor_transaction_id` on the failed payment carries the processor's id when one was returned. Do not retry blindly: send the payment id and the `request_id` to your ZeroPoint contact to reconcile. Also the result when the processor declined or refused the sale on a retry of a `pending` payment, after a network re-send, or in an answer read back from its records: the first attempt may have been charged. |\n| `canceled_on_terminal` | terminal | Customer pressed cancel |\n| `canceled_by_platform` | terminal | You called `POST /v1/payments/{payment_id}/cancel` |\n| `expired` | terminal | Nothing happened before `expires` |\n| `terminal_error` | terminal | The terminal reported a failure without a transaction |\n| `transaction_not_found` | terminal | A terminal callback named a transaction the processor does not know. We never fail on the first report: we re-check on a later delivery, then fail closed and send `payment.needs_attention` with reason `callback_unverified`, because a failed state here is not proof nothing was charged |\n| `partial_approval` | keyed, card_on_file, terminal | The card approved only part of the amount (a partial approval). ZeroPoint never accepts a partial approval and never splits a sale across cards: the partially approved sale is voided at once and the payment fails. Treat it as a decline: tell the customer the card did not cover the full amount and ask for another card (or a smaller amount, as a new payment). Do not retry the same card for the same amount. `payment.failed` carries `partial_approval` with `processor_transaction_id`, `approved_amount_cents`, `requested_amount_cents` and `reversed`. The payment object itself carries the same block as `partial_approval` (null on every other payment), with `reversed_at` once the void is confirmed; a void confirmed later turns `reversed` true there and arrives as `payment.reversed_late`. When `reversed` is false the void was not confirmed and you also receive `payment.needs_attention` with reason `standing_authorization`: the partial authorization may still be standing until reconciliation voids it, so do not charge the customer again for that order until it is resolved. The payment is never refundable and never has a receipt |\n| `amount_mismatch` | terminal | The authorization did not match the payment (reference, currency, amounts, tip); we void it at once. In the rare case the processor refuses the void, that authorization is still standing even though the payment ends here, so do not read `amount_mismatch` as proof nothing was charged: you also receive `payment.needs_attention` with reason `void_rejected`; send the payment id and the `request_id` to your ZeroPoint contact to reconcile |\n\n### What a partial approval looks like at the processor\n\nYou never handle these bodies yourself; ZeroPoint reads them and answers `partial_approval`. They are here so you can recognise one in the processor's own portal or feed. The common point: a partial approval is a *successful* answer, so a status of `AUTHORIZED` or `CAPTURED`, or a processor status of `Successful`, never proves the full amount was approved.\n\n| Source | Shape | Evidence |\n|---|---|---|\n| Processor documentation sample | `status: AUTHORIZED`, `partiallyApproved: true`, `processorResponse.status: Successful`, `statusCode: \"10\"`, `statusMessage: \"PARTIAL APPROVAL\"`, `approvedAmount: 120`, and `amounts.transactionAmount: 120`: the transaction amount already reads the approved figure, not the amount asked | VERIFIED-IN-DOCS, https://docs.poynt.com/processor-integration/building-adapter.html, section \"Step By Step Payment Transaction\" (example transaction data) |\n| Production keyed sales (GymPoint, 11/17/2026) | 2xx with `status: CAPTURED`, `processorResponse.statusCode: \"AP\"`, `approvedAmount` below the amount asked ($0.55 of $50.47; $1.98 of $106.31), `amounts.transactionAmount` reduced to the approved amount. A full approval reads `\"AA\"` | VERIFIED (live), read-only reads of the real processor transactions |\n| Terminal sale with an on-screen tip (sandbox, dev Duo, 11/17/2026) | NOT partial: `status: CAPTURED`, `action: SALE`, `statusCode: \"1\"`, `approvedAmount: 118`, `amounts` order 100 + tip 18 = `transactionAmount` 118, `partiallyApproved: false`. On a tipped sale the approved amount includes the tip | VERIFIED (live), read-only read |\n\nThe processor's documented Orders samples agree with the tip read: when the tip was part of the authorization, `approvedAmount` equals `transactionAmount` including the tip; when the tip was added later by an adjustment (`adjusted: true`), `approvedAmount` stays at the original authorization (VERIFIED-IN-DOCS, https://docs.poynt.com/api-reference/index.html, section \"Orders\", sample responses; a sample, not a definition). The documentation defines neither `approvedAmount` nor the `statusCode` values: `\"AA\"`, `\"AP\"` and `\"1\"` are observed, not documented.\n\nThe processor's transaction model also has a `partialAuthEnabled` boolean (VERIFIED-IN-DOCS, https://docs.poynt.com/api-reference/index.html, model \"Transaction\", and the \"Create transaction\" sample request), with no description. Keyed charges send `partialAuthEnabled: false` (owner decision 11/17/2026); terminal payments have no such field in the Payment Bridge or Payment Fragment options, so nothing is sent for them. The processor's official Node SDK (`poynt` 1.0.1 on npm, `lib/collect.js` `chargeToken`) sends `partialAuthEnabled: false` on every card charge unless told otherwise, documented there as \"Defaults to false\". The sandbox processor accepted and echoed `partialAuthEnabled: false` on a keyed charge on 11/17/2026 (approved, then voided). Whether sending `false` makes the processor refuse a partial approval instead of returning one is still unverified; ZeroPoint's handling above does not depend on it: a partial that arrives is declined and voided.\n\n## A tap after the payment ended\n\nIf a customer taps a physical terminal after you canceled the payment or after it expired, the authorization is real. We void it at once, the payment keeps its final state, and you receive `payment.reversed_late` with `processor_transaction_id` (the authorization we reversed) and `reversal_transaction_id`. Expect `reversal_transaction_id` to be `null`: the processor's answer to a void names the transaction it reversed, not the void it created, so we leave the field empty rather than fill it with an id that means something else. `processor_transaction_id` is the one to log. If the processor refuses that void the authorization is still standing and no `payment.reversed_late` fires; you receive `payment.needs_attention` with reason `void_rejected` instead (`standing_authorization` when the late tap was a partial approval, which reconciliation still voids).\n\nReconciliation is a second source of the same event: it polls the processor independently every five minutes and can find a charge standing behind an ended payment that our own systems never saw arrive at all, not only a late tap we were watching for. `payment.reversed_late` looks the same either way, on purpose, so your handler needs no special case for where it came from. Nothing else to do beyond logging it; do not create another payment for the same order until the customer is ready to tap again.\n\n## When we cannot fix it automatically\n\nReconciliation, or the terminal's own report, can show a divergence between our records and the processor's that is not safe to fix automatically, for example a void the processor refused, a terminal result the processor could not confirm, or a charge marked succeeded that the processor now reports as voided with nothing explaining it. When that happens you receive `payment.needs_attention` instead of a money action, carrying the payment under `data.object`, a `reason`, and a one-sentence `message`. The payment's state and `failure_code` do not change: this is a signal to look, not a new terminal outcome. It fires once per payment per reason and is never repeated, so its absence on a payment is not proof nothing is wrong there. See the reconciliation guide for every reason and what to do about it.\n\n## Waiting for a terminal result\n\nPrefer webhooks: subscribe to `payment.*` and act on `data.object.state`. Without webhooks, poll `GET /v1/payments/{payment_id}` every 1 to 2 seconds until `state` is final, or use `GET /v1/events` with `merchant_id` and `since` filters to reconcile after downtime.\n\n## Subscriptions: a held renewal\n\nA subscription payment (a first payment, a renewal, a retry, an upgrade) follows the same three outcomes. When its outcome is unknown, the invoice is held, not declined: it stays `open` with `collection_status: reconciling`, the subscription keeps its status with `payment_hold` set, and paying or voiding the invoice answers `409 invoice_reconciling` with `Retry-After: 300`, and a plan change answers `409 renewal_due` with `Retry-After: 120` (retry shortly). While the charge is still in flight, before the hold, pay and void answer `409 invoice_payment_in_progress` with `Retry-After: 30`. No `invoice.payment_failed` is sent, no retry is counted and the customer keeps access. When the payment is proven, the hold clears and the usual events follow. Never charge again with a new key while a hold is open. See `subscriptions` and `failed-renewals-and-retries`.\n\n## Errors versus states\n\nA non-2xx response does not by itself prove that nothing changed or no charge occurred. For example, the service can save a pending payment before a processor timeout returns `502`, and `platform_reference_in_use` points to an existing payment. A `201`/`202` also is not proof of payment success: inspect `state`, `failure_code`, ownership, amount and refunded balance. Treat `processor_unverified`, `amount_mismatch`, and unknown failures as needing investigation. Read the existing object or follow the exact documented retry using its original identity; do not switch operations, keys or references to guess at recovery.\n\nNever read HTTP 2xx as approval, ours or the processor's. Processor behaviour, VERIFIED 10/18/2026 on the sandbox: the processor itself answers 2xx with a DECLINED sale. Every charge has three outcomes, captured, declined or unknown, and unknown is not a decline. Unknown covers a timeout, a `5xx`, `processor_unverified`, and a `502 processor_unavailable` on a retry of a payment left `pending`, which is how a processor duplicate-id or in-flight answer surfaces when bounded read-back cannot confirm the original (see the errors guide). When that read-back finds the first attempt itself DECLINED, the payment ends `failed` with `processor_unverified` and that sale's `processor_transaction_id`: an answer read back, or one that arrives on a retry, is never reported as `card_declined`, `nonce_invalid` or `processor_rejected`. `card_declined` is only ever a processor decline, never a stand-in for an unknown answer. A processor answer that decides nothing about the sale is unknown as well: HTTP 408 or 429, a redirect, a 401, 403 or 404, or any error that is not a 400 or 422 in the processor's own error format. Each surfaces as `502 processor_unavailable` with the payment `pending`, and the same key and body resume it. For an unknown outcome, stop retrying, read the payment and reconcile. Never start a new attempt under a new key or reference until it is resolved. One case moves on by itself: the attempt of a hosted checkout session that ended `failed` with `processor_unverified` and is later proven captured is adopted, and `payment.succeeded` follows for the same payment with `adopted: true` (see the hosted checkout concept page).\n\nCommon request errors on `POST /v1/payments`: `idempotency_key_required`, `parameter_invalid` (param names the field), `resource_missing`, `platform_reference_in_use` (409; the message includes the existing payment id), `payment_resume_mismatch` (a pending keyed payment retried with a different nonce or amount; send the original body), `payment_in_progress` (409 with `Retry-After`; a keyed charge for the same `platform_reference` is still in flight, retry the same request), `terminal_offline` (402), `terminal_busy` (409; one payment at a time per physical terminal), `physical_terminal_unavailable` (400; test mode reserves physical terminals), `sandbox_processor_unconfigured` (503), `processor_unavailable` (502, retry with the same key).","updated":1795275945}