Checkout
Start a checkout
Asynchronous. AgentPay opens the merchant in its own browser, reaches the review, mints the card for the real total, pays, and clears 3DS. Returns a checkout_id to poll.
Live API. A POST to /v1/cards issues a real card.
Authorizations
Authorizationstringrequired
Bearer token:
Authorization: Bearer mk_live_.... Create a key in the AgentPay console under Developer, API keys.Body
taskstringrequired
What to buy, in plain English.
merchantstringrequired
The merchant to buy from, e.g.
namecheap or amazon.amountnumberrequired
The most to spend, in dollars. Becomes the card cap.
confirm_paybooleandefault: false
false: the run stops at the final review and waits for the account owner's yes in the console. true: pay without a human yes, up to the cap. The agent's own approval mode can only make this stricter; the response's confirm_pay says what was granted.idempotency_keystring
Your own key for this checkout, up to 120 characters. A retry with the same key returns the same checkout instead of starting a second run. Always send one.
connection_idstring
Run signed in on a connection. When omitted, the newest connected connection for the merchant is used.
own_card_idstring
Pay with the person's connected card (
GET /v1/cards, source: "own") instead of an issued one. The run stops at the review until the cardholder approves on their phone; confirm_pay cannot skip that.resume_ofstring
The id of an ended checkout of yours that left its own items in the basket. The new run continues from that basket.
card_holder_namestring
The name to type on the card for this run. Issued cards only.
start_urlstring
The page to open first: a full https address or a bare domain. Needed when the account has no stored login for the merchant.
Response
checkout_idstring
The run id. Poll it.
statusstring
queued on creation.confirm_payboolean
What was granted.
true only if you asked for it and the agent's mode allows it.hoststring
The site the run will open, once known.
pollstring
The path to poll,
/v1/checkout/{checkout_id}.request_idstring
The request id, also in the
X-Mooj-Request-Id header.Errors
| Status | Code | When |
|---|---|---|
| 400 | invalid_request | task, merchant or amount is missing, or own_card_id is not a card id. |
| 400 | connection_not_found | connection_id names no connected connection on the account. |
| 400 | site_required | No stored login for the merchant. Pass start_url, or connect the merchant once in the console. |
| 400 | site_ambiguous | Several stored logins for the merchant. hosts lists them; pass start_url. |
| 400 | agent_required | The account has several agents and none was named. |
| 402 | plan_limit | The plan's cards a month, or per-card cap, is reached. |
| 404 | card_not_found | No connected card with that own_card_id. |
| 404 | checkout_not_found | resume_of names no checkout of yours. |
| 409 | not_resumable | The resume_of run left nothing in the basket. |
| 409 | agent_paused | The agent is paused in the console. |
| 409 | busy | The merchant session is running another checkout. Retry shortly. |
| 503 | own_card_unavailable | Paying with an own card is not switched on for the account. |
| 502 | checkout_start_failed | The engine could not be started. Retry with the same idempotency_key. |