- You have the buyer’s key. See Manage buyers.
- The buyer has a card that is ready to pay. See Vault a card.
- Your browser worker is ready to finish checkout with Browser Pay attached.
Where each step runs
Your backend stores each buyer’s key and passes it to whatever acts for that buyer.
Choose the purchase type
How you describe the purchase depends on the merchant. Check it first:UCP checkout
When
status is supported. You send the merchant’s UCP checkout, and Sapiom opens it with the merchant. The merchant states the items and total.Browser checkout
For any other merchant. Your agent completes the merchant’s checkout page and tells Sapiom what it’s buying and the total.
unknown means the check failed, not that the merchant lacks UCP. Check again after retryAfterSeconds, or use browser checkout.
Create the transaction
Send the purchase, the card infunding, and your own unique key in an Idempotency-Key header. Omit paymentCardId to use the buyer’s default card.
- UCP checkout
- Browser checkout
checkoutis a UCP checkout request.item.idis the merchant’s product ID. Don’t add anidto the line item itself.shippingis where the order ships and how the merchant reaches the buyer. If nothing ships, such as a digital order, send onlycontact. If you sendshipping, leavebuyerout ofcheckout.- Sapiom opens the merchant’s checkout in the same call, so the response already reflects the merchant’s items and total.
- Only USD is supported. If the merchant’s checkout is in another currency,
nextActionisblockedwithreason: unsupported_currency.
id. Save it: every later step uses it. All fields are in Create a transaction.
Keep the same idempotency key
TheIdempotency-Key header identifies this transaction. Replacing a UCP checkout and canceling take the same header, each with its own key. To resume an unanswered create, send the identical request with the same key. A key used for a different request returns 409 idempotency_conflict.
An uncertain update or cancellation is different: check Recover without buying twice before you resend it. Never start another transaction to escape an uncertain outcome.
The key is required for UCP checkout. Browser checkout accepts a request without one, but send one anyway.
Follow nextAction
Every response has anextAction object. Its type says what to do, and its actor says who does it. Act on it, then get the transaction for the next one. To wait for a change instead of polling, pass maxWaitSeconds (up to 25) and your last version as since:
Change or cancel a transaction
- Change a UCP checkout: replace the checkout with
PUT /v1/transactions/{id}/ucp/checkout, anIdempotency-Keyheader and the full checkout, built from the latest one plus your change. Changing items, the total or the delivery address can mean the buyer approves again, even at the same total. FollownextActionagain. - Change a browser checkout: you can’t. Cancel it and create a new transaction with a new key.
- Cancel: call Cancel a transaction. For a UCP checkout, Sapiom cancels the merchant’s checkout first. For a browser checkout, cancel returns
409 card_relayedafter your agent pays. Cancelling never refunds an order.
Use the MCP tools
An agent connected to the hosted MCP server can usesapiom_request_transaction, sapiom_get_transaction, sapiom_update_transaction and sapiom_cancel_transaction. They return the same nextAction values, and their descriptions say how to call them. See the MCP tools reference.
nextAction on the /ucp/checkout routes
nextAction on the /ucp/checkout routes
The
/ucp/checkout routes use their own nextAction.action names. Get a transaction returns the type names above.wait, revise, blocked and closed have the same names.