Generic Node HTTP recipe
Native test checkout with durable attempts, background reconciliation and signed HTTP notifications.
Compatible with the closed-beta ATM app APIs and versioned ATM event headers. Check atm-api-version on every webhook or XRPC receiver event.
Configure the adapter
Use the pinned SDK supplied for your integration. In examples/atm-node-app, copy adapter.example.ts to private adapter.local.ts. Supply the registered app DID, assigned test broker DID and HTTPS checkout origin, HTTPS dashboard receiptOrigin, registered HTTPS app origin, seller and exact Product/Price refs, private persistent directory, test webhook secrets and a fresh service-auth provider. Each request needs its exact method and the broker service audience. Set ATM_FIXTURE_ADAPTER to that module before starting.
The server listens on loopback port 8787. Route your registered HTTPS app origin to it and explicitly configure signed HTTP at /webhooks/atm. Open that HTTPS origin in the browser. Fixed monthly is not yet available: its exact-invoice recovery API awaits deployment and SDK release, and ATM enables monthly for each app and environment separately.
Purchase and recovery
GET / establishes the private fixture session. Buy Digital Fixture sends POST /buy/digital. The backend captures the original request and key before native createCheckout, saves the result, and redirects to ATM. The return page is /status/<purchaseId>, authorized by the same session. It exposes no ATM status capability. Receipt links use the dashboard origin.
The worker reconciles getCheckoutStatus by authenticated POST with the original status token in JSON, even without a browser return or notification. Uncertainty replays the original create bytes and key. A signed notification wakes that reconciler; delivery identity excludes the retry timestamp.
For your own backend, keep the delivery claim lifecycle and durably enqueue reconciliation before acknowledging. The queue worker reads canonical status before applying an idempotent purchase effect.
import { createNodeWebhookHandler } from "@atmosphere-money/app-node";
export const handleWebhook = createNodeWebhookHandler({
// Current and previous test signing secrets, during rotation.
secret: [process.env.ATM_WEBHOOK_SECRET, process.env.ATM_WEBHOOK_PREVIOUS_SECRET]
.filter((value): value is string => Boolean(value)),
deliveryStore: {
claim: claimWebhookDelivery,
complete: completeWebhookDelivery,
release: releaseWebhookDelivery
},
onEvent: async (event) => {
if (event.environment !== "test" || event.apiVersion !== "2026-07")
return { status: 422, body: { error: "UnexpectedEventBinding" } };
await enqueueReconciliation(event); // the worker reads canonical status
return { body: { ok: true } };
}
});Verify locally
cd examples/atm-node-app
npm install --package-lock=false --prefix ../../packages/app-node
npm run build --prefix ../../packages/app-node
npm install
npm run typecheck
npm run smoke
ATM_FIXTURE_ADAPTER=./adapter.local.ts npm run devThe smoke checks synthetic crash/restart recovery and signed notification retries. Configure the private adapter before running the server; local smoke results do not establish hosted payment qualification.