- Your agent is connected with the buyer’s key.
- The buyer has a card that is ready to pay. See Vault a card.
sapiom_check_transaction_compatibilityreturnssupportedfor the merchant.- Your browser worker is ready to finish checkout.
Where each step runs
Your backend stores each buyer’s key and passes it to the agent and the browser worker for that buyer’s session.
Request the transaction
checkoutis a UCP checkout request.item.idis the merchant’s product ID; the lineidis your own label.paymentMethodIdis theidof the buyer’s chosen card.idempotencyKeyis your own unique ID for this transaction. See below.
transactionId. Save it: every later step uses it. All arguments are in the MCP tools reference.
Calling Sapiom from your backend instead? See Use REST instead.
Keep the same idempotency key
The key identifies this transaction. If a request times out or you lose the response, send the identical request with the same key to pick it back up. Don’t switch to a new key to get past an uncertain result: that can buy twice.Follow nextAction
Every result has anextAction object. Its type says what to do. Act on it, then read the transaction with sapiom_get_transaction to get the next one.
Change or cancel a transaction
- Change:
sapiom_update_transactionreplaces the whole checkout. SendtransactionId, the latestversion, a new stableidempotencyKeyfor this change, and the full checkout. Changing items or the total can mean the buyer approves again. - Cancel:
sapiom_cancel_transactionwithtransactionIdand anidempotencyKey. It cannot stop a checkout that is already completing, and it does not refund an order.
Use REST instead
Your backend can run the same transaction with the buyer’s key.- Create a transaction.
estimateis your expected total and is optional. OmitpaymentCardIdto use the buyer’s default card. - Open the checkout with
POST /v1/transactions/{id}/ucp/checkout, sending the UCPline_itemsandbuyer. If you sentshippingwhen you created the transaction, leave outbuyer. - Read
nextAction.actionin each response. While it’supdate, replace the checkout withPUTon the same path.
Idempotency-Key header.
REST names some actions differently from the MCP tools:
wait, revise, blocked and closed have the same names.