Checkout
How apps start native ATM-hosted checkout, retry it safely, and read canonical status.
Compatible with the closed-beta ATM app APIs and versioned ATM event headers. Check atm-api-version on every webhook or XRPC receiver event.
Hosted checkout
ATM-hosted checkout is the checkout surface for every human payment. ATM owns the payment form, ATM Wallet authorization, explicit card-saving consent, same-tab sign-in, receipts and payment state. Stripe Link is disabled. Your app owns the product page, the Buy button and fulfilment.
Invited apps start with one fixed-price digital purchase in test mode; other product types arrive as ATM admits them. Embedded checkout is on the roadmap, with hosted checkout as the fallback.
Seller permission
The seller grants your app payment permission and accepts the exact seller terms in their ATM dashboard. ATM checks that permission, the accepted terms and the seller's payment setup on every checkout. Seller permission never stands in for buyer consent. Creator-setup reads such as getRecipientApproval and getPayoutStatus describe setup progress for your settings screens; they are not checkout authority.
Create a checkout
money.atmosphere.payment.createCheckout is a JSON POST procedure. Authenticate it with a fresh app service-auth JWT whose lxm is this method and whose aud is <brokerDid>#atmosphere_money_broker for your assigned test broker.
POST /xrpc/money.atmosphere.payment.createCheckout
Authorization: Bearer <fresh app service-auth JWT>
Content-Type: application/json
{
"environment": "test",
"idempotencyKey": "order_123_attempt_1",
"items": [{
"recipient": "did:plc:seller",
"listing": { "uri": "at://did:plc:seller/money.atmosphere.product/digital", "cid": "bafy..." },
"price": { "uri": "at://did:plc:seller/money.atmosphere.price/fixed", "cid": "bafy..." },
"quantity": 1,
"paymentType": "shop"
}],
"returnUrl": "https://app.example/orders/123/return",
"cancelUrl": "https://app.example/orders/123/return",
"metadata": { "appOrderId": "order_123" }
}With the SDK, capture the request with attempts.capture and send it with attempts.recover, as in the Quickstart. If your app already stores equivalent attempts, atm.createCheckout(input) is the low-level call; persist the exact request before calling it.
import { createAtmAppClient } from "@atmosphere-money/app-node";
const atm = createAtmAppClient({
brokerUrl: "https://your-assigned-test-checkout.example",
serviceAudience: "did:plc:bbbbbbbbbbbbbbbbbbbbbbbb#atmosphere_money_broker",
getServiceAuthToken: ({ lxm, aud }) => mintMyAppServiceAuthJwt({ lxm, aud }),
});
// The input you persisted before this call, sent unchanged on every retry.
const created = await atm.createCheckout(input);Request fields
Required marks what this test integration must send. Other fields in the SDK types, such as shipping, quotes, discounts, order routing and recurring cadence, belong to capabilities ATM admits separately; leave them out of fixed digital checkout.
| Field | Type | Required | Description |
|---|---|---|---|
| items | array | yes | Exactly one item. |
| items[].recipient | did | yes | The seller DID. |
| items[].listing | strongRef | yes | The exact Product record: AT-URI plus CID. |
| items[].price | strongRef | yes | The exact money.atmosphere.price record for that Product. |
| items[].quantity | integer | yes | 1 for fixed digital checkout. |
| items[].paymentType | string | no | shop for a digital purchase. |
| items[].amount | integer | no | Omit for fixed prices. ATM derives the amount from the Price; only an admitted chosen-amount flow sends one. |
| idempotencyKey | string | yes | 1 to 200 characters from A–Z, a–z, 0–9 and . _ : / -. Assigned once per attempt. |
| environment | string | yes | Always test for this integration. The SDK attempt helper refuses anything else. |
| returnUrl, cancelUrl | https URL | no | On your registered app origin. Navigation only, never payment proof. |
| checkoutExpiresAt | datetime | no | An earlier end for the browser checkout. Checkouts last 45 minutes at most. |
| metadata | object | no | Private correlation such as your order ID. Never buyer personal data or secrets. |
| payerDid, payerAssertionJwt | did, JWT | no | An authoritative pair: supply both or neither. See Payer identity. |
| payerDidHint | did | no | A display-only account suggestion. It never authenticates the payer. |
| customerEmail | string | no | Unverified, editable prefill. Never identity or receipt authority. |
Response
| Field | Type | Required | Description |
|---|---|---|---|
| paymentId | string | yes | ATM’s ledger identity for this payment. |
| statusToken | string | yes | Your app’s private polling capability for getCheckoutStatus. It never expires by time. Keep it on your server. |
| url | https URL | yes | The hosted checkout for the buyer. It carries its own browser bearer. |
| expiresAt | datetime | yes | When the browser checkout ends. The payment can still settle afterwards. |
| reservationExpiresAt | datetime | no | A separate reservation deadline, when one applies. |
Save the whole response on the original attempt before redirecting. Only url goes to the browser.
Retries and errors
createCheckout is idempotent per authenticated app, environment and idempotencyKey. An exact retry returns the original result, even after the browser checkout expires. Retry with the same request and key, and a fresh service-auth JWT. No error, missing reply or elapsed deadline proves that a payment did not happen.
| Code | HTTP | Retry | Cause | Developer action |
|---|---|---|---|---|
| AuthenticationRequired | 401 | yes | The JWT is missing, expired, already used, or names the wrong method or audience. | Mint a fresh token for the exact method and audience, then retry the same request. |
| RateLimitExceeded | 429 | yes | Too many requests from this network or app. | Back off, then retry the same request and key. |
| CheckoutUnavailable | 503 | yes | Temporarily unavailable, including while ATM pauses native checkout. | Retry later with the same request and key. |
| IdempotencyConflict | 400 | no | The key was already used for a different request. | Your stored request changed. Fix that; never mint a new key to get unstuck. |
| InvalidCheckout | 400 | no | The request, its listing or Price, or its URLs are not acceptable. | Keep the attempt for support. Do not replace it automatically. |
| RecipientNotPayable | 400 | no | The seller cannot accept this payment right now. | Show an unavailable state until the seller finishes setup. |
| CurrencyUnsupported | 400 | no | The currency is not enabled for this seller or environment. | Keep the purchase action unavailable. |
| TestEnvironmentUnavailable | 400 | no | Test checkout is not available on this deployment. | Check that you used the assigned test checkout origin. |
| PayerAssertionInvalid | 400 | no | payerAssertionJwt failed verification or does not match payerDid. | Ask the signed-in buyer to try again, as a new attempt with a new assertion. |
| PayerBindingUnsupported | 400 | no | The requested payer binding is not available for this checkout. | Omit payerBinding, or use the binding your flow supports. |
| CheckoutPayerChanged | 400 | no | An exact retry found that the buyer switched accounts. | The original checkout may still settle. Keep polling its status token; never create a replacement. |
Read status
money.atmosphere.payment.getCheckoutStatus is also a JSON POST procedure. Send the saved token in the body with a fresh JWT for this method; never in a URL, a GET request or a log line. Poll from a backend worker with bounded backoff, even if the buyer never returns, and stop only at a terminal status.
POST /xrpc/money.atmosphere.payment.getCheckoutStatus
Authorization: Bearer <fresh app service-auth JWT>
Content-Type: application/json
{ "statusToken": "<saved status token>" }| pending | Keep polling. It can outlive expiresAt and the advisory finalizesAt. |
|---|---|
| completed | Settled. fulfillment: “fulfil” authorizes a direct digital grant; order_pending and order_conflict need the order owner first. |
| failed, canceled, expired | Unpaid terminal outcomes. |
| CheckoutNotFound | Malformed, unknown or not your token. Not an outcome: check your app, broker and environment binding and keep the attempt. |
| CheckoutUnavailable | Temporarily unavailable. Retry later; this is not pending or terminal. |
An authenticated completed status is the same settled fact that a signed notification carries. Route both through one reconciler, so each purchase effect happens once and stays bound to the attempt you saved.
Payer identity
payerDid and payerAssertionJwt are an authoritative pair: supply both or neither. The assertion is a service-auth JWT from the signed-in buyer, with the buyer's DID as issuer, your broker's #atmosphere_money_broker audience, and money.atmosphere.payment.assertPayer as its method. It is frozen with the original request, so never refresh it inside a retry, and never substitute a raw OAuth access token.
An asserted payer is fixed by default. Opt into payerBinding: "switchable" only when your app reconciles the final payer from status. Without an assertion, payerDidHint is display only. Every status reports the payer and a payer revision that freezes at the first terminal status; reconcile against that, not your initial hint. ATM owns disclosure, receipt consent, Wallet access and card saving.
Receipts and public records
ATM owns the payment receipt. Buyers open it from ATM's authenticated receipt view on the dashboard origin; your confirmation page is not a receipt. The test flow writes no public payment records. When a completed status carries receipt or proof refs, they are independently verifiable evidence, never the fulfilment trigger. The SDK attempt helper keeps the first terminal snapshot it sees. A publicRecords value on the request is an app-side cap only; it never grants the buyer's publication consent.