AI Checkout Intents

The AI Checkout Intents endpoint allows you to generate a hosted checkout page from a simple natural language intent.
Instead of sending full parameters, just send an intent string — our AI layer will parse the amount, currency, payment type, and description, then return a response identical to the Checkout Page API.


Endpoint

POST /v1/checkout/intents

Request

Minimum Required

{
  "intent": "Create a checkout page for Order #123 total Rp125.000"
}

Optional

  • metadata – (stringified JSON) Overrides AI-generated metadata. Must include "source": "ai_intents" if provided.

Processing Rules

  • Amount Extraction: "Rp125.000"125000.

  • Currency Resolution:

    • If mentioned in intent → use it.
    • Else → inferred from secret key region (e.g., IDIDR).
    • Fallback → account default currency.
  • Type Determination:

    • "QRIS""qrcode"
    • "Virtual Account""virtual_account"
    • "E-Wallet""ewallet"
    • "Card""credit_card"
    • Not mentioned → empty (""), checkout page will present multi-method options.
  • Description: Shortened to ≤ 25 characters.

  • Redirect URLs: Always taken from Dashboard settings.

  • ExternalId: Auto-generated, prefixed CPI-. Example: CPI-20250917-XYZ123.

  • Metadata: AI-generated (order ref, plan, description, intent hash). Returned in webhooks.


Response

{
  "id": "co_01JABCXYZ",
  "externalId": "CPI-20250917-XYZ123",
  "status": "PENDING",
  "checkoutUrl": "https://checkout.paystrator.com/co_01JABCXYZ",
  "currency": "IDR",
  "amount": 125000,
  "type": "checkout_page",
  "createdAt": "2025-09-24T08:30:00Z"
}

Example Scenarios

1. Standard Multi-Method

Request

{ "intent": "Create a checkout page for Order #123 total Rp125.000" }

Response

{
  "id": "co_01JWEB001",
  "externalId": "CPI-20250917-XYZ123",
  "status": "PENDING",
  "checkoutUrl": "https://checkout.paystrator.com/co_01JWEB001",
  "currency": "IDR",
  "amount": 125000,
  "type": "",
  "createdAt": "2025-09-24T03:10:00Z"
}

2. Defined Type (QRIS Only)

Request

{ "intent": "Generate QRIS payment Rp150.000 for INV-9001" }

Response

{
  "id": "co_01JQRIS001",
  "externalId": "CPI-20250917-XYZ123",
  "status": "PENDING",
  "checkoutUrl": "https://checkout.paystrator.com/co_01JQRIS001",
  "currency": "IDR",
  "amount": 150000,
  "type": "qrcode",
  "createdAt": "2025-09-24T03:20:00Z"
}

3. With AI-Generated Metadata

Request

{ "intent": "Top up Premium Plan Rp125.000 for ORD-2025-0001" }

Response

{
  "id": "co_01JTOPUP001",
  "externalId": "CPI-20250917-XYZ123",
  "status": "PENDING",
  "checkoutUrl": "https://checkout.paystrator.com/co_01JTOPUP001",
  "currency": "IDR",
  "amount": 125000,
  "type": "",
  "createdAt": "2025-09-24T08:30:00Z"
}

Webhook Metadata

{
  "order_ref": "ORD-2025-0001",
  "plan": "Premium",
  "amount_text": "Rp125.000",
  "currency": "IDR",
  "description_short": "Premium Plan Rp125k",
  "intent_hash": "2f1c...",
  "source": "ai_intents"
}

Error Codes

  • CURRENCY_RESOLUTION_FAILED – unable to determine currency.
  • IDEMPOTENCY_REPLAY – idempotency key reused with different payload.
  • VALIDATION_ERROR – malformed request.