Create a checkout session (hosted payment page)
Opens a Wire-hosted payment page for a PaymentIntent and returns its `url`. Redirect the buyer there. The page lists the operators the buyer can pay with, confirms the intent, shows the QR code / bank-app links, and redirects to `success_url` / `cancel_url` when done. Create the session right after creating the intent: the intent must still be in `requires_payment_method` (not confirmed, not canceled, not expired). Do not call `/confirm` yourself for this intent. **Errors** (besides the common ones): - `400 invalid_request_error` (`payment_intent`) — `payment_intent` omitted. - `404 resource_missing` — no such PaymentIntent in this project. - `400 payment_intent_unexpected_state` (`payment_intent`) — the intent is not awaiting payment. - `400 checkout_url_invalid` (`success_url`) — `success_url` or `cancel_url` is not an absolute `http(s)` URL. - `403 connector_required` / `403 settlement_account_required`.
/v1/checkout/sessionsAuthorization
bearerAuth Secret API key as a bearer token: Authorization: Bearer sk_live_….
Test keys (sk_test_…) are refused with 401 test_mode_unavailable.
Keys are issued per project in the dashboard. Never expose a secret
key in browser or mobile code.
In: header
Header Parameters
Required on every POST and DELETE (missing → 400 parameter_missing; longer than 255 characters → 400 parameter_invalid). Use one stable key per logical operation, e.g. your order id plus the action. A retry with the same key and the same body returns the recorded response (header Idempotent-Replayed: true) instead of acting twice. The same key with a different body or path → 409 idempotency_key_in_use. While the first request is still running, a duplicate gets 409 idempotency_in_flight — wait a moment and retry. Successful (2xx) and declined (402) responses are recorded for 48 hours; other errors are not, so a retry after fixing a 400 runs normally. Keys are scoped to the API key's project.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/v1/checkout/sessions" \ -H "Idempotency-Key: order-1001-create" \ -H "Content-Type: application/json" \ -d '{ "payment_intent": "pi_k3vq7m2xw5nbt4rj6yhc2dpa7e", "success_url": "https://yourshop.mn/orders/1001", "cancel_url": "https://yourshop.mn/cart" }'{
"id": "cs_w6qz3k2mx5tn4vbr7cyj2hpa5k",
"object": "checkout_session",
"payment_intent": "pi_k3vq7m2xw5nbt4rj6yhc2dpa7e",
"status": "open",
"url": "https://pay.wire.mn/c/cs_w6qz3k2mx5tn4vbr7cyj2hpa5k",
"success_url": "https://yourshop.mn/orders/1001",
"cancel_url": "https://yourshop.mn/cart",
"allowed_operators": [],
"created": 1791774005
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_missing",
"message": "amount is required",
"param": "amount",
"request_id": "req_8f3a1c9e5b7d2f4a6c0e9b1d"
}
}{
"error": {
"type": "api_error",
"code": "test_mode_unavailable",
"message": "test keys are not accepted by this API; use a live secret key",
"request_id": "req_8f3a1c9e5b7d2f4a6c0e9b1d"
}
}{
"error": {
"type": "api_error",
"code": "connector_required",
"message": "connect a payment operator before creating payments — see the Connectors page in your dashboard",
"request_id": "req_8f3a1c9e5b7d2f4a6c0e9b1d"
}
}{
"error": {
"type": "invalid_request_error",
"code": "resource_missing",
"message": "no such payment_intent",
"request_id": "req_8f3a1c9e5b7d2f4a6c0e9b1d"
}
}{
"error": {
"type": "idempotency_error",
"code": "idempotency_in_flight",
"message": "A request with this Idempotency-Key is still being processed; retry shortly",
"request_id": "req_8f3a1c9e5b7d2f4a6c0e9b1d"
}
}