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 two main payment initiation methods:User Payment (Recommended)
For users with AcountPay accounts or those who want to create one:Guest Payment
For one-time payments without account creation:Method Parameters
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) |
onSuccess | function | ❌ No | Success callback function |
onError | function | ❌ No | Error callback function |
Real Implementation Examples
Basic E-commerce Integration
Basic E-commerce Integration
React Integration Example
React Integration Example
Platform Integration
Simple Website Integration
Simple Website Integration
For basic websites, add this to your checkout page:
WordPress/WooCommerce Integration
WordPress/WooCommerce Integration
Add this to your theme’s Configuration: Go to WordPress Admin → Settings → General → AcountPay Client ID
functions.php:Shopify Integration
Shopify Integration
Step 1: Go to Online Store → Themes → Actions → Edit codeStep 2: In Step 3: Create Step 4: Add to Step 5: Include in templates:
theme.liquid, add before </head>:snippets/acountpay-button.liquid:config/settings_schema.json: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

