Payment lifecycle
How a native checkout moves from creation to a terminal status, and what your app does at each step.
Compatible with the closed-beta ATM app APIs and versioned ATM event headers. Check atm-api-version on every webhook or XRPC receiver event.
Lifecycle overview
Treat ATM checkout as a state machine that your backend follows. The browser redirect keeps the buyer oriented; your purchase effect comes from canonical status after the payment settles.
- Capture
App
Save the exact createCheckout request and idempotency key for an authorized Buy.
- Create
App -> ATM
POST createCheckout. ATM returns paymentId, statusToken, the checkout URL and expiresAt.
- Pay
Buyer
Complete hosted checkout with ATM Wallet, a new card, Apple Pay, Google Pay or another eligible method.
- Settle
ATM
Record the payment in ATM’s ledger only after the processor confirms it.
- Notify
ATM -> App
Send a verified wake-up through your receiver or signed webhook.
- Reconcile
App -> ATM
POST getCheckoutStatus with the saved token and apply the result once.
Browser return versus fulfilment
| Browser return | Shows confirmation or processing UI. It can arrive before settlement, or never. |
|---|---|
| Status polling | The canonical path. A backend worker POSTs getCheckoutStatus until the status is terminal. |
| Verified notification | Carries the same settled fact and wakes the same worker early, so each effect still happens once. |
| Delivery log | Repair receiver failures with redrive. The buyer never pays again. |
Statuses
| pending | Waiting for settlement. fulfillment is not_applicable. An optional finalizesAt is an advisory target, not a deadline. |
|---|---|
| completed | Settled, with completedAt. fulfillment is fulfil for a direct digital purchase, or order_pending or order_conflict when an order owner must confirm first. |
| failed | The payment did not succeed. The checkout closed unpaid. |
| canceled | The checkout was canceled before payment. |
| expired | The checkout ended unpaid. |
Stop polling only at a terminal status. Refunds and disputes never move a completed status backwards; they arrive as separate events and need their own handling. The payer and payer revision freeze at the first terminal status.
App events
ATM sends app events after state changes. AT Protocol apps receive them through the canonical XRPC receiver; conventional web apps can select signed HTTP instead. Verify each event, then let your reconciler read canonical state before acting.
| payment.completed | Wake reconciliation for the matching attempt; grant on completed plus fulfil. |
|---|---|
| payment.refunded | Reverse or flag the purchase according to your app’s policy. |
| payment.disputed | Pause or review the purchase while the dispute is open. |
| product.archived | Stop offering the item. Historical purchases stay valid. |
Payloads for every event type are on Webhook events.
Receipts and public records
ATM owns the payment receipt; buyers open it from the authenticated receipt view on the dashboard origin. The test flow writes no public payment records. When a completed status includes receipt or proof refs, they are independently verifiable evidence, never the fulfilment trigger.
Retries and reconciliation
- Capture each attempt before contacting ATM, and send its original request and key on every retry.
- Store the ATM paymentId and your effect key beside your order.
- Deduplicate notifications on stable delivery identity before queuing work.
- If a buyer sees a charge but your order is unpaid, keep reconciling the original attempt. Never ask them to pay again.
- If your receiver fails, fix it and redrive the stored delivery from the dashboard.