Skip to content

Step 4: Hosted Checkout ​

Send the customer to an IIMMPACT-hosted page to pay an existing order. The page lists available methods and saved cards, calculates fees, asks the customer to confirm the total, and handles card entry, FPX bank selection and 3DS. You do not build a payment UI or handle card data.

Use this instead of Create Payment. Create the order first with Create Order; its payment_method_code only sets that order's calculation, and the customer can pick another method on the page.

Endpoint ​

http
POST https://api.iimmpact.com/v2/checkout-sessions

Request headers ​

FieldTypeRequiredDescription
X-Api-KeystringYesYour API key; keep it on your backend.
X-TimestampstringYesCurrent Unix time in seconds; within five minutes of server time.
X-NoncestringYesFresh identifier for every request, including retries.
X-SignaturestringYesv1= followed by the request's HMAC signature.

Follow API Key Authentication. Sign the exact body, or an empty body for bodyless requests, and the sorted query when present.

FieldTypeRequiredDescription
Content-TypestringYesapplication/json.
Idempotency-KeystringYesUnique key for this session; reuse it for network retries.

Request fields ​

FieldTypeRequiredDescription
order_idstringYesExisting unexpired order in your account.
customer_external_idstringYesYour customer ID, 1–100 characters, matched exactly. The page shows this customer's saved cards.
customer_namestringYesCustomer's name, 1–50 characters, no control characters. Pass the name you already hold for the customer, such as from your KYC records; the page does not ask for it.
return_urlstringYesYour HTTPS destination after payment, with the same restrictions as Create Payment.
customer_fee_percentstringNoPercentage of the fee the customer bears, 0.00–100.00; defaults to 0.00. The customer cannot change it.

Unsupported fields return validation_error.

Request example ​

json
{
  "order_id": "01J9Z6Q4M8N2P5R7S9T1V3W5X7",
  "customer_external_id": "CUS-1042",
  "customer_name": "Aisha Rahman",
  "return_url": "https://shop.example.com/payment-return",
  "customer_fee_percent": "50.00"
}

Response fields ​

Fields below are inside data.

FieldTypeDescription
session_idstringCheckout session ID. Not an order or payment ID.
order_idstringThe order this session pays.
hosted_payment_urlstringPage to open for the customer. It contains a secret token: open it only for this customer, and never log or share it.
expires_atstringWhen the link stops working, 30 days after creation. New payments still stop at the order's expires_at.

Response example — 201 ​

json
{
  "data": {
    "session_id": "01J9Z6QBX3D5F7H9K1M3P5R7T9",
    "order_id": "01J9Z6Q4M8N2P5R7S9T1V3W5X7",
    "hosted_payment_url": "https://pay.iimmpact.com/c/01J9Z6QBX3D5F7H9K1M3P5R7T9#st=mpcs_REDACTED",
    "expires_at": "2026-10-14T02:01:00.000Z"
  }
}

Creating a session starts no payment. A payment is created only when the customer confirms the total on the page.

Open the page and handle the return ​

Redirect the customer's browser, or open a webview, to hosted_payment_url. Each payment attempt on the page follows the usual payment rules: one active payment per order, and a new attempt after a failure. Do not create a custom payment for an order the customer is paying on the hosted page.

After a payment attempt, the page offers a Return to merchant button that opens your return_url with order_id and payment_id added. Those IDs are not proof of payment. Authenticate the customer and read the payment and order, or use webhooks. Payment, order and refund webhooks are the same as for custom payments.

Errors ​

HTTPCodeAction
400validation_errorFix the fields listed in error.details. See validation details.
404order_not_foundCheck the order ID and access.
409order_expiredThe order no longer accepts payments. Create a new order.
409idempotency_conflictThis key was already used with different request data. Use a new key for a different session.
409session_creation_in_progressRetry the same request and key shortly to get the original response.

See shared errors. Next: Track Results.

IIMMPACT API Documentation