API Reference

Create Checkout Page API

Headers

KeyValue
AuthorizationBearer <publicAccessToken>
Idempotency-Key[uuid] (recommended)

Notes on headers:

  • Same key + same request body → returns the same checkout session (no duplicates).
  • Different body with the same key → 409 Idempotency Mismatch.

Request Body

{
  "externalId": "ORD-2025-0001",
  "currency": "IDR",
  "amount": 125000,   
  "description": "Top up Premium Plan",
  "successUrl": "https://merchant.com/thank-you?o=ORD-2025-0001",
  "cancelUrl": "https://merchant.com/cancel?o=ORD-2025-0001",
  "metadata": "{ \"note\": \"optional\" }",
  "type": "virtual_account"
}

Field Reference

FieldRequiredTypeNotes
externalIdstringUnique per client. If duplicate return 409 DUPLICATE_EXTERNAL_ID.
currencystringIDR (more in future).
amountintegerSmallest unit (Rupiah). Omit to ask end-user on page.
descriptionstringShown on checkout page.
successUrlstringRedirect user to this URL if payment success. Overrides dashboard default. Required here or in dashboard.
failedUrlstringRedirect user to this URL if payment failed. Overrides dashboard default. Required here or in dashboard.
metadatastringCustom key-value pairs. Stored in Paystrator and returned in API/webhook, but never sent to providers. Read more about metadata here.
typeenumPreselect flow: virtual_account / ewallet / qrcode / credit_card. If omitted: end-user will chooses.

End-User Page Flow Guide**

  • If amount if empty, end-user will be prompted to input payment amount.
  • If type:
    • is empty, end-user can choose the available payment method
    • is filled (with ewallet / qrcode / virtual_account / credit_card), end-user will be directed to respective payment type. So, end-user can't choose the payment method available.

Responses

201 Created

{
  "id": "co_01JABCXYZ",
  "externalId": "ORD-2025-0001",
  "status": "PENDING",
  "checkoutUrl": "https://checkout.paystrator.com/co_01JABCXYZ",
  "currency": "IDR",
  "amount": 125000,
  "type": "qrcode",
  "createdAt": "2025-08-23T03:50:00Z"
}

Field Notes

FieldDescription
idCheckout session ID (prefix co_).
checkoutUrlSend your customer here (redirect or link).
statusPENDING on create
amountnull if omitted in request

Error Payload (standard)

{
  "error": {
    "code": "INVALID_TYPE_FOR_TENANT",
    "message": "The selected type is not enabled for this tenant.",
    "requestId": "req_abc123"
  }
}

Error Codes

HTTPCodeDescription
400INVALID_AMOUNTAmount invalid/missing for fixed flows.
400MISSING_REDIRECT_URLSNeither API nor dashboard provided success/cancel.
400INVALID_TYPE_FOR_TENANTType not enabled for this tenant.
400NO_AVAILABLE_PAYMENT_TYPETenant has no payment methods enabled.
403PERMISSION_DENIEDAPI key lacks required permissions.
409DUPLICATE_EXTERNAL_IDexternalId already used.
409IDEMPOTENCY_CONFLICTSame Idempotency-Key with different body.
422INVALID_PROVIDER_MAPPINGProvider not mapped in production.

Status and Expiration Rules


StatusDescriptionExpiry Rules
CreatedCheckout created24h
OpenedEnd-user opened link15 mins from first open
CompletedPaid
ExpiredNot paid before expiry

For UI purposes:

  • Any status other than Completed is displayed as UNPAID.
  • Completed is displayed as PAID.
Language
Click Try It! to start a request and see the response here!