CartirraAPI
Get API keys

Create a checkout session

posthttps://api.cartirra.com/v1/checkout-sessions

Open a checkout session for a cart; hand its client secret to the widget.

Authentication
Secret key (Authorization: Bearer sk_…). How keys work
Permission
checkout_sessions:create
Idempotency
Idempotency-Key header recommended: a retry with the same key returns the first response. Details

Headers

  • Idempotency-Keystring

    Unique per request; replays return the first response

Request body required

JSON (Content-Type: application/json).

  • linesarray of LineDtorequired
  • customerCustomerHintDto

    Prefills the widget; not shared without consent

  • metadataobject

    Your own key-value pairs, returned on the order

  • success_urlstringnullable

    Example https://shop.example.com/thanks

  • store_idstring (uuid)nullable

    Fix the store. Otherwise the shopper picks one for pickup, dine-in or courier, and delivery comes from the cheapest open store that reaches the address

  • attributionSessionAttributionDto

    Where the shopper came from, for your ad platforms' conversion events (the widget adds what it finds on your page)

Responses

201CreatedCreatedSessionResponse
  • idstringrequired

    Example cs_0193…

  • statusstringrequired

    One of open, awaiting_payment, completed, expired, cancelled

  • currencystringrequired

    Example NGN

  • linesarray of objectrequired

    name, quantity, unit_price, sku, image_url, description and modifiers (name, quantity, price, group, sku); locked: true on lines the shopper can't change

  • changesarray of objectrequired

    "What changed": price, quantity or removed lines, and modifier_price or modifier_removed, from the merchant's cart check

  • fulfilmentobjectnullable
  • contactstringrequired

    One of shopper, guest, none

  • notestringnullable
  • adjustmentsobjectrequired
  • priceobjectnullable

    Price breakdown: lines, items_subtotal, total

  • order_idstringnullable

    Example ord_0193…

  • store_idstringnullable
  • metadataobjectrequired
  • success_urlstringnullable
  • expires_atstringrequired
  • created_atstringrequired
  • client_secretstringrequired

    Give to the widget; never log it

Errors

Every error has the same body: { "error": { "code", "message", "details"?, "request_id" } }. See Errors for every code.

  • 400The request is malformed or a field is invalid (`VALIDATION_FAILED`).
  • 401Missing, malformed, revoked or expired API key (`UNAUTHENTICATED`), or a key this route does not accept, such as a public key (`CREDENTIAL_NOT_ACCEPTED`).
  • 403The key may not do this (`PERMISSION_DENIED`, `LIVE_MODE_NOT_ENABLED`, `PLAN_LIMIT_REACHED`, …).
  • 409The resource is in a state that does not allow this (for example `ORDER_NOT_CANCELLABLE`, `REFUND_NOT_ALLOWED`).
  • 422The request is valid but breaks a business rule.
  • 429Too many requests for this key (`RATE_LIMITED`); wait for `Retry-After` seconds.
  • 500Something went wrong on our side (`INTERNAL`). Safe to retry with the same `Idempotency-Key`.