Getting Started with the Charge SDK
The Charge SDK collects payment details and processes the payment inside a DataMesh-hosted experience, keeping your application outside PCI scope. To integrate it, your application needs to do three things.
1. Implement a redirect page
The Charge SDK redirects the customer to a result page once the payment completes. Build a page to receive that redirect, and configure its Redirect URL in the Merchant Portal payment configuration.
The redirect carries the result as query parameters (status, charge_id, order_id, config_id). Use them to show the customer a result, but treat the page as display-only — see Redirect and Popup Flows.
2. Implement a webhook endpoint
DataMesh delivers the authoritative payment result to your backend by calling a webhook. Implement an endpoint to receive it, and configure its Webhook URL in the Merchant Portal.
On the charge webhook, confirm the result by calling GET /charge/{charge_id} — see Webhooks for the payload, delivery/retry behaviour, and idempotency guidance, and the Data Model for how to interpret the charge status.
Never update an order's status from the redirect page alone. Only mark an order paid after confirming the result through the Charge API (GET /charge/{charge_id}) or a webhook.
3. Mount the Charge SDK
Mount the SDK in your checkout, passing the order_id from POST /order_token together with your merchant_id, config_id, and public_key. See Mounting the SDK for the mount reference and Merchant Portal configuration steps.
How it fits together
- The customer reaches your checkout (merchant frontend).
- The frontend requests checkout from your backend.
- The backend calls the Charge API
POST /order_tokento create anorder_id. - The backend returns the
order_idto the frontend. - The frontend mounts the Charge SDK.
- The customer completes payment in the Charge SDK.
- The Charge SDK redirects to your configured Redirect URL.
- Your backend confirms the result — either the frontend triggers a check that calls
GET /charge/{charge_id}, or the backend waits for the result delivered to your Webhook URL.
For the full sequence, including the settlement leg and the diagram, see the End-to-End Payment Flow guide.