Docs

First real app tutorial

The canonical native test integration: capture a durable attempt, create checkout, reconcile canonical status, verify notifications and fulfil once.

Closed beta@atmosphere-money/app-nodeSDK beta: 0.0.0-beta.3ATM API beta: 2026-0671 published lexicons

Compatible with the closed-beta ATM app APIs and versioned ATM event headers. Check atm-api-version on every webhook or XRPC receiver event.

Goal

This is the canonical ATM integration path for invited apps. At the end, your app sells one fixed-price digital item in test mode, survives restarts and lost replies without a second charge, and grants each purchase exactly once from canonical ATM status. The Quickstart explains each step; this tutorial runs it end to end.

  1. 01

    Capture

    On an authorized Buy, the app saves the exact createCheckout request and idempotency key.

  2. 02

    Create checkout

    The app POSTs the captured body with fresh service-auth and saves paymentId, statusToken and the checkout URL.

  3. 03

    Pay

    The buyer completes ATM-hosted checkout. ATM owns Wallet consent, card saving and receipts.

  4. 04

    Reconcile

    A backend worker POSTs the saved status token to getCheckoutStatus until the status is terminal.

  5. 05

    Notify

    A verified receiver event or signed webhook wakes the same worker early.

  6. 06

    Fulfil

    On completed plus fulfil, the app inserts the effect key and grants the purchase in one transaction.

App server

Mints service-auth, stores attempts, runs the worker and verifies notifications.

ATM dashboard

Holds your test configuration, notification settings, delivery log and redrive.

ATM checkout

Owns the buyer payment form, Wallet, card saving, receipts and payment state.

App fulfilment

Runs only after authenticated completed status for the saved attempt.

Prerequisites

  • An invited app DID and its assigned test configuration: test broker DID and checkout origin, dashboard origin, test seller, and exact Product and fixed Price refs.
  • A backend that keeps secrets private and mints fresh service-auth through your app account’s PDS.
  • Durable attempt storage: a private persistent volume for one server, or your shared database for a fleet.
  • An HTTPS app origin for return URLs, and a reverse proxy to your local server when you test signed HTTP.

1. Configure test mode

EnvironmentSend environment: “test” on every checkout. Test and live settings, secrets and receivers are separate.
Event deliveryAT Protocol apps default to the canonical XRPC receiver. Supplying a webhook URL explicitly selects signed HTTP.
Signing secretNeeded only for signed HTTP. Keep it in server-side configuration, with the previous secret during rotation.
Event selectionSubscribe to the events your app handles. Any verified event only wakes reconciliation.
EconomicsATM prices each checkout from the seller’s accepted terms. Dashboard fee settings do not reprice them.

2. Run the Node reference

The Node reference uses a private adapter for your registered app DID, test broker DID and HTTPS checkout origin, dashboard receipt origin, HTTPS app origin, exact Product/Price refs, persistent private storage, test webhook secrets and a fresh service-auth provider. Open the registered HTTPS app origin through your reverse proxy; the server itself listens on loopback port 8787.

sh
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
cp adapter.example.ts adapter.local.ts
# Configure the registered test binding and private adapters first.
ATM_FIXTURE_ADAPTER=./adapter.local.ts npm run dev

Open the app origin, use Buy Digital Fixture, and complete the hosted test checkout. The session-bound status page shows the local purchase state; it never exposes the status token. The compact source file at docs/developer/examples/happy-path-app.ts shows the same capture, recovery and notification sequence without the HTTP server.

3. Wire your own backend

In your app, the checkout route loads the buyer's own order and its stored attempt, then captures and recovers it. The request and key were assigned once when the order was created, so a double-click or browser retry reuses the same operation.

ts
import type { AtmCreateCheckoutInput } from "@atmosphere-money/app-node";

// POST /orders/:id/checkout. Your session and CSRF checks run first, and the
// order is loaded by owner. Never trust a browser-supplied amount, ref or DID.
export async function createCheckoutForOrder(order: {
  attemptId: string; // unique, assigned once with the order
  request: AtmCreateCheckoutInput; // stored once, never rebuilt
}): Promise<Response> {
  await attempts.capture(order.attemptId, order.request);
  const attempt = await attempts.recover(order.attemptId);
  return Response.json(
    { url: attempt.checkout!.url }, // never the statusToken
    { headers: { "cache-control": "private, no-store" } },
  );
}

Run the reconciliation worker from Quickstart step 6 on a schedule and from your notification queue. Grant the purchase in the same database transaction that inserts the effect key.

4. Verify status reconciliation

  • Capture completes before any request to ATM; the attempt exists even if the process stops mid-request.
  • After a timeout or restart, recover returns the same paymentId and checkout URL.
  • The worker polls getCheckoutStatus by POST with service-auth. It never uses the browser checkout URL.
  • Reprocessing the same completed status does not fulfil twice, because the effect key is unique.
  • A canceled or expired checkout leaves the order unpaid, and a new purchase uses a new attempt.

5. Verify notification delivery

  • A test event from Developer settings verifies, with environment test and API version 2026-07.
  • Redriving the same delivery returns 200 without repeating the purchase effect.
  • A notification that arrives before the create response is saved still leads to exactly one grant.
  • A failed enqueue releases the claim, so ATM retries the delivery.
  • No status token, checkout URL, signature, raw body or secret appears in logs.

6. Inspect dashboard state

App dashboardConfirm the test environment and your notification settings.
Delivery logConfirm delivery status, attempts, response codes and the redrive action.
PaymentsConfirm the test payment appears for your app with the ID your attempt saved.
ReceiptOpen the receipt from the dashboard origin as the buyer. Your confirmation page is not the receipt.

7. Before asking for more

  • Fixed digital test checkout passes every check above, including restart recovery.
  • Receiver redrive and duplicate deliveries pass.
  • Purchase actions for product types ATM has not admitted stay unavailable.
  • Private buyer data stays off public records and out of logs.
  • If ATM later grants live access, live secrets and receivers stay separate from test ones.