Skip to content

Approve a checkout

Create a bounded purchase intent and approve only the checkout digest the user reviewed.

Updated View as Markdown

Prerequisites

Use a management credential with application write access. Do not send personal credentials or payment data.

Create the intent

curl -X POST https://api.agent.mq/v1/applications/app_<32-lowercase-hex>/purchases \
  -H "Authorization: Bearer $AGENTMQ_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"merchantOrigin":"https://merchant.example","itemDescription":"One blue notebook","maxTotalUsdMicros":50000000,"currency":"USD"}'

Read current state

GET /v1/applications/{appId}/purchases/{purchaseId} returns purchase, revision, and the next required action.

Approve the exact snapshot

curl -X POST https://api.agent.mq/v1/applications/app_<32-lowercase-hex>/purchases/pur_<32-lowercase-hex>/approve \
  -H "Authorization: Bearer $AGENTMQ_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"checkoutDigest":"<64-lowercase-hex>","expectedRevision":<revision>}'

Verify

The approved digest must equal the currently stored checkout digest. If the checkout or revision changed, the API returns a conflict and requires a fresh review.

Next steps

Navigation

Type to search…

↑↓ navigate↵ selectEsc close