Checkout
View as Markdown

Open a hosted checkout session

Needs the checkout:write scope, or a full-access key. About scopes

POST
/api/v1/checkout-sessions

Authorization

Authorization
Required
Bearer <token>

An API key: gpy_test_… or gpy_live_… (or an agent key, agk_…).

In: header

Request Body

application/jsonOptional

customer_idstring

Format: "uuid"

customer_external_idstring

Minimum length: 1Maximum length: 200

modestring

Value in: "subscription" | "setup"

itemsarray<object>

plan_idstring

Format: "uuid"

plan_codestring

Minimum length: 1Maximum length: 200

seatsinteger

Minimum: 1Maximum: 100000

promotion_codestring

Minimum length: 1Maximum length: 100

allow_promotion_codesboolean

Default true.

lock_itemsboolean

Default false. True: plan, seats, interval and items are fixed. The page shows them read-only, and the hosted quote and confirm refuse any change (422 items_locked).

trial_daysinteger

Minimum: 0Maximum: 730

success_url
Required
string

Format: "uri"

cancel_url
Required
string

Format: "uri"

metadataobject

At most 50 keys (each ≤ 40 characters); copied onto the subscription.

curl -X POST "https://globalymint.com/api/v1/checkout-sessions" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "customer_external_id": "ws_123",
    "items": [
      {
        "plan_code": "pro_monthly",
        "quantity": 5
      }
    ],
    "success_url": "https://app.example.com/billing?ok=1",
    "cancel_url": "https://app.example.com/billing"
  }'

The session; send the payer to url (valid 24 hours).

{
  "data": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "object": "checkout_session",
    "mode": "subscription",
    "status": "open",
    "url": "http://example.com",
    "expires_at": "2019-08-24T14:15:22Z"
  },
  "_agent": {
    "summary": "string",
    "status": "ok",
    "next_actions": [
      "string"
    ],
    "warnings": [
      "string"
    ]
  },
  "api_version": "2026-07-01"
}