Paycose Docs
Checkout
POST/checkouts

Create Checkout Session

Body — 1:1 with CreateCheckoutSessionDTO (app/handlers/v1/checkout_session/request.go).

A checkout is created for a collection target (target_type + target_id) — an invoice or a payment_intent, identical convention to POST /payment_links. Amount, currency, customer, transfer destination and allowed methods are derived from the target — no provider/payment method is chosen here. Returns { id, url, session, status }; share url with the customer.

FieldRequiredNotes
target_type✓invoice or payment_intent
target_id✓id of the target to collect
success_urloptionalredirect after payment
cancel_urloptionalredirect on cancel
metadataoptionalfree-form

Request

Example

curl -X POST 'https://api.paycose.com/api/v1/app1/platform/wallet/checkouts/' \
  -H 'X-Session-Token: {{session_token}}' \
  -H 'X-Country: {{country}}' \
  -d '{
  "mode": "<string>",
  "target_type": "invoice",
  "target_id": "{{invoice_id}}",
  "line_items": [
    {
      "price": "<string>",
      "quantity": 0
    }
  ],
  "subscription_data": {
    "customer_id": "<string>",
    "currency": "<string>",
    "trial_period_days": 0,
    "trial_end": "<RFC3339 timestamp>",
    "description": "<string>",
    "coupon": "<string>",
    "default_tax_rates": [
      "<string>"
    ],
    "default_fees": [
      "<string>"
    ],
    "billing_cycle_anchor": "<RFC3339 timestamp>",
    "collection_method": "<string>",
    "payment_settings": {
      "save_default_payment_method": "<string>"
    },
    "metadata": {}
  },
  "success_url": "https://example.com/thanks",
  "cancel_url": "https://example.com/cart",
  "allow_promotion_codes": false,
  "promotion_code": "<string>",
  "payment_method_types": [
    "<string>"
  ],
  "payment_method_collection": "<string>",
  "metadata": {}
}'

Headers

NameValue
X-Session-Token{{session_token}}
X-Country{{country}}

Body

NameTypeValue
modestring<string>
target_typestringinvoice
target_idstring{{invoice_id}}
line_itemsarray[1]
subscription_dataobject{…}
success_urlstringhttps://example.com/thanks
cancel_urlstringhttps://example.com/cart
allow_promotion_codesbooleanfalse
promotion_codestring<string>
payment_method_typesarray[1]
payment_method_collectionstring<string>
metadataobject{…}
{
  "mode": "<string>",
  "target_type": "invoice",
  "target_id": "{{invoice_id}}",
  "line_items": [
    {
      "price": "<string>",
      "quantity": 0
    }
  ],
  "subscription_data": {
    "customer_id": "<string>",
    "currency": "<string>",
    "trial_period_days": 0,
    "trial_end": "<RFC3339 timestamp>",
    "description": "<string>",
    "coupon": "<string>",
    "default_tax_rates": [
      "<string>"
    ],
    "default_fees": [
      "<string>"
    ],
    "billing_cycle_anchor": "<RFC3339 timestamp>",
    "collection_method": "<string>",
    "payment_settings": {
      "save_default_payment_method": "<string>"
    },
    "metadata": {}
  },
  "success_url": "https://example.com/thanks",
  "cancel_url": "https://example.com/cart",
  "allow_promotion_codes": false,
  "promotion_code": "<string>",
  "payment_method_types": [
    "<string>"
  ],
  "payment_method_collection": "<string>",
  "metadata": {}
}

Responses

400400 Bad Request

Headers

NameValue
Content-Typeapplication/json

Body

{
  "object": "error",
  "code": "<string>",
  "key": "<string>",
  "i18n_key": "<string>",
  "message": "<string>",
  "request_id": "<string>"
}
500500 Internal Server Error

Headers

NameValue
Content-Typeapplication/json

Body

{
  "object": "error",
  "code": "<string>",
  "key": "<string>",
  "i18n_key": "<string>",
  "message": "<string>",
  "request_id": "<string>"
}

On this page