MobiariDocs

Pay for the cart

POST
/storefront-api/{store_slug}/api/payments/intents

Turns the cart into an order (once; later calls reuse it) and starts a payment with the store's gateway: a PIX charge (answered with the QR code in next_action) or a card payment with a Mercado Pago card token. An order already paid answers its approved payment instead of charging again. A card approved on the spot marks the order paid.

Path Parameters

store_slug*string

Store slug

Header Parameters

x-cart-id?|

The shopper's cart; the cart_id cookie or body field works too

Formatuuid
Idempotency-Key?string

A unique value (e.g. a UUID) per logical request. Retrying with the same key within 24 hours replays the first response instead of repeating the side effect; the replay carries Idempotent-Replayed: true. Reusing a key for a different request is a 422 idempotency_key_reused; retrying while the first is still running is a 409 idempotency_request_in_progress. JSON bodies up to 1 MB.

Lengthlength <= 255

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

application/json

curl -X POST "https://example.com/storefront-api/string/api/payments/intents" \  -H "Content-Type: application/json" \  -d '{    "method": "pix"  }'
{
  "amount_cents": 0,
  "currency": "string",
  "error_code": "string",
  "error_message": "string",
  "expires_at": "2019-08-24T14:15:22Z",
  "intent_id": "05704cef-194d-4987-b2cb-c2c20c9cd88a",
  "method": "pix",
  "next_action": {},
  "order_id": "93101167-9065-4b9c-b98b-5d789a3ed9fe",
  "provider_code": "string",
  "snapshot": {},
  "status": "pending"
}
{
  "code": "not_found",
  "details": {},
  "error": "Order not found"
}
{
  "code": "not_found",
  "details": {},
  "error": "Order not found"
}
{
  "code": "not_found",
  "details": {},
  "error": "Order not found"
}
{
  "code": "not_found",
  "details": {},
  "error": "Order not found"
}
{
  "code": "not_found",
  "details": {},
  "error": "Order not found"
}
{
  "code": "not_found",
  "details": {},
  "error": "Order not found"
}