Prerequisites
- Installed AcountPay SDK (see Install the SDK)
- Your AcountPay Client ID from the merchant dashboard
Initialization
Initialize the SDK with your client ID.Basic Setup
CDN Integration (Recommended)
For quick setup, use our CDN:UMD Build Setup (Script Tag)
If using the UMD build from npm:Configuration Options
| Option | Type | Required | Description |
|---|---|---|---|
clientId | string | ✅ Yes | Your AcountPay client ID from the dashboard |
Payment Methods
The SDK provides three payment methods. Payment Link is recommended for most website integrations.Payment Link (Recommended)
Creates a payment and redirects the customer to a hosted payment page where they select their bank and complete authentication. After payment, the customer is returned to yourredirectUrl with a ?status=success|failed|pending query parameter.
User Payment
For users with AcountPay accounts or those who want to create one:Direct Bank Payment
Redirects the customer directly to Token.io’s hosted bank authentication page. The customer is redirected away from your site for bank selection and SCA. Best suited for simple integrations where you don’t need control over the return URL.Method Parameters
createPaymentLink (Recommended)
| Parameter | Type | Required | Description |
|---|---|---|---|
amount | number | ✅ Yes | Payment amount in major currency units (e.g., 10.50) |
referenceNumber | string | ✅ Yes | Unique reference number (your order ID) |
redirectUrl | string | ✅ Yes | URL to return the customer to after payment |
description | string | ❌ No | Description shown to the customer during payment |
currency | string | ❌ No | Currency code (default: DKK) |
webhookUrl | string | ❌ No | Server-side URL to receive payment status updates |
{ success, redirectUrl, paymentId, message }
initiateUserPaymentByEmail
| Parameter | Type | Required | Description |
|---|---|---|---|
amount | number | ✅ Yes | Payment amount in major currency units |
requestId | string | ✅ Yes | Unique request identifier (your order ID) |
callbackURL | string | ✅ Yes | URL to redirect after payment completion |
initiatePayment
| Parameter | Type | Required | Description |
|---|---|---|---|
amount | number | ✅ Yes | Payment amount in major currency units |
referenceNumber | string | ✅ Yes | Unique reference number (your order ID) |
currency | string | ❌ No | Currency code (default: DKK) |
initiatePayment redirects the customer away from your site to Token.io for bank authentication. Use createPaymentLink instead if you need control over where the customer returns after payment.Real Implementation Examples
Basic E-commerce Integration (Recommended)
Basic E-commerce Integration (Recommended)
React / Next.js Integration Example
React / Next.js Integration Example
Platform Integration
Simple Website Integration
Simple Website Integration
For basic websites, add this to your checkout page:
Important Notes
Client ID Setup
Client ID Setup
- Get your Client ID from the AcountPay merchant dashboard
- Replace
"your-client-id-here"with your actual Client ID - Use different Client IDs for sandbox and production environments
Amount and Reference Guidelines
Amount and Reference Guidelines
- Amount: Use actual transaction amounts in major currency units (e.g., 10.50 for $10.50)
- Reference: Use your actual order IDs or transaction references for tracking
- This allows you to match successful payments back to orders in your system
Testing
Testing
- Sandbox: Use sandbox Client ID for testing
- Production: Switch to production Client ID when ready
- Error Handling: Always implement proper error handling
Next Steps
See Initialize Payment for detailed examples and Integration Testing for testing guidelines.Troubleshooting
- “Acount is not defined”: Ensure the script is loaded before initialization
- Invalid client ID: Verify your client ID from the merchant dashboard
- Payment not processing: Check browser console for errors and ensure all parameters are provided

