{"object":"doc","slug":"charge-a-saved-card","title":"Charge a saved card","summary":"Charge a saved payment method with method card_on_file, handle every outcome, and retry without ever charging twice.","tags":["guide","card-on-file","payments"],"body":"# Charge a saved card\n\nA saved card (`pm_...`, see `save-a-card`) is charged with the same call as any payment, with `method: card_on_file`. The answer comes back in the same request, as for a keyed payment. You need the scope `payment_methods:charge` as well as `payments:write`: a key without it cannot charge a saved card.\n\n```\nPOST /v1/payments\n{\"merchant_id\":\"mch_01j...\",\"amount_cents\":4900,\"platform_reference\":\"sub-77-2026-12:a1\",\"method\":\"card_on_file\",\"payment_method\":\"pm_01j...\",\"initiated_by\":\"merchant\",\"description\":\"December membership\"}\n```\nSend an `Idempotency-Key`. `merchant_id` is optional for `method: card_on_file`: without it, the `ZeroPoint-Account` header, else the platform's only merchant in this mode (see `save-a-card`). Terminal and plain keyed payments still need it in the body.\n\n- `payment_method` is the saved card. It must belong to the same merchant.\n- `initiated_by` is required: `customer` when the cardholder is in your app choosing to pay now, `merchant` when your schedule or the merchant's staff started it (a renewal). It is a record only and changes nothing in the charge.\n- `nonce`, `terminal_id`, `terminal_options` and `save_payment_method` are refused with `card_on_file`.\n\n## One reference per attempt\n\nCharge each obligation (a billing cycle, an invoice) under a reference and a key you derive from it, with an attempt number: `{cycle_id}:a{attempt}`, the same string for `platform_reference` and the `Idempotency-Key`. Start at attempt 1. Keep the same attempt for every retry of an unknown outcome, and move to the next attempt only after a definite failure. A reference made from the cycle alone could never be charged again after a decline, because the reference stays pinned to the failed payment. References starting with `zp:` are reserved for ZeroPoint.\n\n## Outcomes\n\n| Answer | Meaning | What to do |\n|---|---|---|\n| `201`, `state: succeeded` | Paid | Done |\n| `201`, `failed`, `card_declined` | The card was declined | Final for this reference. Tell the cardholder; try again later as a new attempt, or ask for another card |\n| `201`, `failed`, `duplicate_transaction` | The processor's duplicate screen refused a second equal charge on the card shortly after another. Not a card decline | Do not ask for another card. Check the earlier charge is the one you meant. If a second equal charge is really intended, send it later as a new attempt |\n| `201`, `failed`, `processor_rejected` | The processor refused the request as invalid. Not a card decline | Final for this reference. Contact ZeroPoint if it repeats |\n| `201`, `failed`, `partial_approval`, `partial_approval.reversed: true` | The card approved only part of the amount; ZeroPoint voided it at once. A saved card is never charged for less than asked | Final for this reference. Treat as a decline |\n| `201`, `failed`, `partial_approval`, `partial_approval.reversed: false` | As above, but the void is not yet confirmed: part of the amount may still be held on the card | Do not charge that obligation again yet (rule 5 below) |\n| `201`, `failed`, `processor_unverified` | Unknown: the card may or may not have been charged | Stop (rule 3 below) |\n| `502 processor_unavailable` | The answer was lost; the payment stays `pending` | Retry the identical request (rule 1 below) |\n| `409 payment_in_progress` | A charge for this reference is still running, or the processor answered and ZeroPoint is still recording it | Wait `Retry-After` seconds and retry the identical request |\n| `409 payment_method_unusable` | The saved card cannot be charged (deleted, erased, the merchant disconnected or changed account). No payment was written | Rule 6 below |\n| `409 payment_resume_method_unusable` | A `pending` payment holds this reference and may have captured, and its card can no longer be used to finish it | Rule 6 below |\n| `409 payment_resume_mismatch` | You changed the card or the amount for a reference whose payment is still `pending` | Send the original body |\n| `400 card_on_file_unavailable` | Live mode, and saved cards are not switched on for your platform | See `going-live` |\n| `403 insufficient_scope` | The key lacks `payment_methods:charge` | Use a key that has it |\n\nThe payment object's `partial_approval` block is the source of truth for a partial approval: `partial_approval.reversed` turns true once the void is confirmed and never goes back. The `payment.failed` event carries the same block as it was at that moment, and `payment.reversed_late` announces a later confirmation. If you missed an event, read `GET /v1/payments/{payment_id}`. Do not retry with a new reference, and do not wait in a loop on the payment: wait for the webhook, or retrieve the payment.\n\n## Retry rules\n\n1. On 502 `processor_unavailable`, or 409 `payment_in_progress`, retry the identical request: same `Idempotency-Key`, same body. At most 3 retries, spaced (for example 5 seconds, 1 minute, 5 minutes), all inside 15 minutes.\n2. Never change the card, the amount or the `platform_reference` for that charge. The service refuses it (`payment_resume_mismatch`), and a new reference could be a second charge.\n3. If it is still unknown, stop. `processor_unverified` means \"unknown\", not \"declined\". Do not charge the cycle again under a new reference until the outcome is known.\n4. A definite failure (`card_declined`, `duplicate_transaction`, `processor_rejected`, `card_not_saved`, and `partial_approval` whose `payment.failed` event says `partial_approval.reversed: true`) is final for that reference. A later attempt is a new logical charge with a new reference, on your own schedule.\n5. `partial_approval` with `reversed: false` is unresolved: do not charge that obligation again until `payment.reversed_late` names the transaction, the payment object's `partial_approval.reversed` reads true, or ZeroPoint resolves the `standing_authorization` alert.\n6. `payment_method_unusable` (409) wrote no payment: fix the cause and send again under a new `Idempotency-Key` with the same reference. `payment_resume_method_unusable` (409) means a pending payment holds the reference and may have captured: treat it as rule 3 (stop; do not charge again until the outcome is known). A partial sale that is never voided settles, and a new full charge on top is an overcharge by the partial amount.\n\n\"Known\" means one of: the `payment.succeeded` or `payment.failed` webhook, a `GET /v1/payments/{payment_id}` that shows a final state with a code other than `processor_unverified`, or an answer from ZeroPoint. A payment left `pending` for 15 minutes is ended by ZeroPoint as `failed` / `processor_unverified` (the `payment.failed` event says so); its reference stays pinned. `handle-every-payment-state` explains how an unverified payment is resolved.\n\n## Deleting a card with a charge in flight\n\n`DELETE /v1/payment_methods/{payment_method_id}` (and its twin `POST /v1/payment_methods/{payment_method_id}/detach`) answers 409 `payment_method_in_use` with `Retry-After` while a payment that uses the card is still `pending`: that payment may need the card to finish. Wait the seconds given and send the delete again. A pending payment is ended within 15 minutes, or kept longer only while ZeroPoint is still recording an answer the processor gave.\n\n## Refunds, voids and receipts\n\nA saved-card payment is refunded, voided and receipted exactly like a keyed payment (`refunds-and-voids`); nothing needs the saved card, and deleting the card later changes nothing for past payments. In test mode the refund and the void go to the sandbox processor, as for any keyed payment.\n\n## Expired and replaced cards\n\nZeroPoint does not refuse a charge because the card's printed expiry has passed, and a decline never marks the card unusable. There is no card updater: when a card is replaced, ask the cardholder to save the new one (as a new payment method) and delete the old one. The saved card's `token` is never shown and cannot be exported.\n\n## Test mode\n\nA card saved from a test card token is charged with no processor: save `\"nonce\": \"tok_visa\"` to see charges succeed and `\"nonce\": \"tok_chargeDeclined\"` to see them declined (`sandbox`, \"Test card tokens\"). Charges of a card typed into the form go to the sandbox processor: `4761 7390 0101 0010` succeeds and `4111 1111 1111 1111` is declined (`save-a-card`, \"Testing in the sandbox\").","updated":1795275945}