Step 1: Install the SDK
Choose one of two ways to use the SDK:a. Install via NPM
b. Use via CDN (Script Tag)
Step 2: Generate a Payment Request (Backend)
You must first create a payment request from your backend using the following API:Step 3: Initialize and Launch the SDK
Note: To use the Atoa Web Client SDK, you must first whitelist your domain. Set your domain or subdomain (e.g. https://pay.yourbrandname.co.uk) via the Atoa Dashboard or mobile app: Whitelist your domain here
Here’s how to launch the SDK on a button click after generating the paymentRequestId:
Example using Script Tag
Step 4: Handle Payment Status
The Web SDK notifies you of real-time payment updates via the onPaymentStatusChange callback. You can display your order summary page when the payment status isCOMPLETED.
⚠️ Important: If the payment status is PENDING, display an intermediate state in your UI and continue showing it until a COMPLETED update is received.
To track the final payment outcome beyond the client, we recommend implementing webhooks (Recommended) or polling (as a fallback). For full implementation details, refer to the Getting Started Guide.
Step 5: Handle Events
Here’s what each event callback does:Callback Payload Reference
Callback Payload Reference
Below are the payload structures you can expect inside each callback:
onPaymentStatusChange(data)
Triggered when the payment status updates. HandleCOMPLETED, PENDING and FAILED statuses.onError(error)
Fired when there’s an issue with SDK initialization, config, or runtime.onClose(data)
Called when the user closes the payment dialog after any action.onUserCancel(paymentRequestId)
Triggered when the user closes the widget without making a payment.Step 6: Cleanup the SDK
Use dispose() to clear the SDK from memory and DOM.- Disposes the payment widget.
- Removes listeners and internal state.
- Recommended after every completed or cancelled session.
Step 7: Test in Sandbox
To use sandbox mode, change the environment to “SANDBOX”:COMPLETED, FAILED and PENDING payments before going live.
Step 8: Brand & Customize (Optional)
- Theme Color: Choose your brand’s hex color in the dashboard. The widget will automatically reflect your theme color. Update your theme color here
- Design Guidelines: Refer to our official branding guide to correctly showcase “Pay by Bank” in your checkout. View Figma file
- Custom Domain: Set your domain or subdomain (e.g., pay.yourbrandname.co.uk) from the Atoa Dashboard or mobile app. Whitelist your domain here
Note: You do not need to pass the domain or theme color in the SDK. Simply configure these once from your Dashboard or Atoa Business App