- An AcountPay account – You’ll need your Client ID from the merchant dashboard
- A supported environment – JavaScript/TypeScript (browser or Node.js), React optional
Installing AcountPay SDK
Choose from multiple installation methods based on your setup.Quick Start (Recommended)
For fastest setup, use our CDN:Copy
<script src="https://cdn.acountpay.com/sdk/acount.umd.js"></script>
<script>
const acount = new Acount({
clientId: 'your-client-id-here'
});
</script>
Package Manager Installation
NPM Installation
Copy
npm i @acountpay/pis-sdk
Yarn Installation
Copy
yarn add @acountpay/pis-sdk
Usage Methods
ES Module Import
ES Module Import
Copy
import AcountPay from '@acountpay/pis-sdk';
const acount = new AcountPay({
clientId: 'your-client-id'
});
CDN Script Tag (Recommended)
CDN Script Tag (Recommended)
Copy
<script src="https://cdn.acountpay.com/sdk/acount.umd.js"></script>
<script>
const acount = new Acount({
clientId: 'your-client-id'
});
</script>
NPM Package UMD Build
NPM Package UMD Build
Copy
<script src="/node_modules/@acountpay/pis-sdk/dist/acount.umd.js"></script>
<script>
const acount = new Acount({
clientId: 'your-client-id'
});
</script>
Unpkg CDN
Unpkg CDN
Copy
<script src="https://unpkg.com/@acountpay/[email protected]/dist/acount.umd.js"></script>
<script>
const acount = new Acount({
clientId: 'your-client-id'
});
</script>
Platform-Specific Integration
E-commerce Platforms
- Shopify
- WooCommerce
Method 1: Simple Product/Cart Page IntegrationMethod 2: Checkout Integration (Advanced)For checkout page integration, you’ll need Shopify Plus or use checkout extensibility:Configuration Steps:Important Notes:
- Go to Online Store → Themes → Actions → Edit code
- Find
theme.liquidand add the SDK before</head>:
Copy
<script src="https://cdn.acountpay.com/sdk/acount.umd.js"></script>
- Create a new snippet file
snippets/acountpay-button.liquid:
Copy
{% comment %}
AcountPay Payment Button Snippet
Usage: {% include 'acountpay-button' %}
{% endcomment %}
<div class="acountpay-payment-section" style="margin: 20px 0; padding: 15px; border: 1px solid #e0e0e0; border-radius: 8px; background: #f9f9f9;">
<h3 style="margin: 0 0 10px 0; font-size: 18px;">Pay with Bank Account</h3>
<p style="margin: 0 0 15px 0; color: #666; font-size: 14px;">Secure bank-to-bank payment via AcountPay</p>
<button
id="acountpay-payment-btn-{{ section.id | default: 'main' }}"
class="btn btn-primary acountpay-btn"
style="background: #0066cc; color: white; padding: 12px 24px; border: none; border-radius: 4px; cursor: pointer; font-size: 16px; width: 100%;"
type="button"
>
Pay with AcountPay
</button>
</div>
<script>
(function() {
const buttonId = 'acountpay-payment-btn-{{ section.id | default: "main" }}';
const button = document.getElementById(buttonId);
if (button && typeof Acount !== 'undefined') {
button.addEventListener('click', function() {
const acount = new Acount({
clientId: "{{ settings.acountpay_client_id }}" // Configure in theme settings
});
// Get product/cart info
{% if product %}
// Single product page
const amount = {{ product.price | divided_by: 100.0 }};
const productId = {{ product.id }};
const referenceNumber = "SHOPIFY-PRODUCT-" + productId + "-" + Date.now();
{% elsif cart %}
// Cart page
const amount = {{ cart.total_price | divided_by: 100.0 }};
const referenceNumber = "SHOPIFY-CART-" + Date.now();
{% else %}
// Fallback
const amount = 0;
const referenceNumber = "SHOPIFY-" + Date.now();
{% endif %}
if (amount <= 0) {
alert('Please add items to cart first');
return;
}
acount.initiatePayment({
amount: amount,
referenceNumber: referenceNumber,
onSuccess: function(result) {
console.log('Payment successful:', result);
// Option 1: Redirect to a thank you page
window.location.href = "/pages/payment-success";
// Option 2: Show success message and redirect to cart
// alert('Payment successful! Redirecting to cart...');
// window.location.href = "/cart";
},
onError: function(error) {
console.error('Payment failed:', error);
alert('Payment failed. Please try again or contact support.');
}
});
});
} else if (button) {
// SDK not loaded yet, retry after a delay
setTimeout(function() {
if (typeof Acount !== 'undefined') {
button.click();
} else {
alert('Payment system is still loading. Please try again in a moment.');
}
}, 1000);
}
})();
</script>
- Add AcountPay settings to your theme:
config/settings_schema.json and add this section:Copy
{
"name": "AcountPay Settings",
"settings": [
{
"type": "text",
"id": "acountpay_client_id",
"label": "AcountPay Client ID",
"info": "Get this from your AcountPay merchant dashboard"
},
{
"type": "checkbox",
"id": "acountpay_enabled",
"label": "Enable AcountPay",
"default": false
}
]
}
- Add the button to product pages by editing
sections/product-form.liquid:
Copy
<!-- Add this after the Add to Cart button -->
{% if settings.acountpay_enabled and settings.acountpay_client_id != blank %}
{% include 'acountpay-button' %}
{% endif %}
- Add to cart page by editing
templates/cart.liquid:
Copy
<!-- Add this in the cart template -->
{% if settings.acountpay_enabled and settings.acountpay_client_id != blank and cart.item_count > 0 %}
{% include 'acountpay-button' %}
{% endif %}
- Create
checkout.liquid(Shopify Plus only):
Copy
{{ content_for_header }}
{{ checkout_scripts }}
{{ checkout_stylesheets }}
<script src="https://cdn.acountpay.com/sdk/acount.umd.js"></script>
<div class="main">
<div class="step">
{{ content_for_layout }}
<!-- Add AcountPay option after payment methods -->
{% if checkout.payment_due > 0 %}
<div class="acountpay-checkout-option">
<h3>Alternative Payment Method</h3>
<button id="acountpay-checkout-btn" class="btn btn-primary">
Pay {{ checkout.payment_due | money }} with Bank Account
</button>
</div>
{% endif %}
</div>
</div>
<script>
document.getElementById('acountpay-checkout-btn')?.addEventListener('click', function() {
const acount = new Acount({
clientId: "{{ settings.acountpay_client_id }}"
});
acount.initiatePayment({
amount: {{ checkout.payment_due | divided_by: 100.0 }},
referenceNumber: "{{ checkout.order_number | default: checkout.id }}",
onSuccess: function(result) {
// Complete the Shopify checkout
window.location.href = "{{ checkout.success_url }}";
},
onError: function(error) {
alert('Payment failed: ' + error.message);
}
});
});
</script>
- Go to Online Store → Themes → Customize
- Navigate to Theme settings → AcountPay Settings
- Enter your Client ID and enable AcountPay
- Save and test with a product
pages/payment-success.liquid:Copy
<div class="payment-success">
<h1>Payment Successful!</h1>
<p>Thank you for your payment. Your order has been received and will be processed shortly.</p>
<p><a href="{{ routes.collections_url }}" class="btn">Continue Shopping</a></p>
</div>
- Test thoroughly before going live
- Consider inventory management for successful payments
- Set up webhooks to handle order fulfillment
- This integration works alongside existing payment methods
Method 1: Simple Integration (Recommended)Method 2: Plugin Approach (For Developers)Create a custom plugin file Configuration:
- Add the SDK script to your theme’s
functions.php:
Copy
// Add to your theme's functions.php
function acountpay_enqueue_scripts() {
if (is_checkout() || is_cart()) {
wp_enqueue_script(
'acountpay-sdk',
'https://cdn.acountpay.com/sdk/acount.umd.js',
array(),
'1.0.4',
true
);
}
}
add_action('wp_enqueue_scripts', 'acountpay_enqueue_scripts');
// Add AcountPay settings to admin
function acountpay_add_settings() {
add_settings_section(
'acountpay_section',
'AcountPay Settings',
null,
'general'
);
add_settings_field(
'acountpay_client_id',
'AcountPay Client ID',
'acountpay_client_id_callback',
'general',
'acountpay_section'
);
register_setting('general', 'acountpay_client_id');
}
add_action('admin_init', 'acountpay_add_settings');
function acountpay_client_id_callback() {
$client_id = get_option('acountpay_client_id', '');
echo '<input type="text" name="acountpay_client_id" value="' . esc_attr($client_id) . '" class="regular-text" />';
echo '<p class="description">Get this from your AcountPay dashboard</p>';
}
- Add payment button to checkout page template or use a plugin like “Code Snippets”:
Copy
// Add this to checkout page or via Code Snippets plugin
function add_acountpay_checkout_button() {
if (is_checkout()) {
$client_id = get_option('acountpay_client_id', '');
if (!empty($client_id)) {
?>
<div id="acountpay-payment-section" style="margin: 20px 0; padding: 20px; border: 1px solid #ddd; border-radius: 8px;">
<h3>Pay with AcountPay</h3>
<p>Secure bank-to-bank payment</p>
<button type="button" id="acountpay-payment-btn" class="button alt" style="background: #0066cc; color: white; padding: 12px 24px; border: none; border-radius: 4px; cursor: pointer;">
Pay with Bank Account
</button>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const acountPayBtn = document.getElementById('acountpay-payment-btn');
if (acountPayBtn) {
acountPayBtn.addEventListener('click', function() {
if (typeof Acount === 'undefined') {
alert('Payment system is loading, please try again in a moment.');
return;
}
const acount = new Acount({
clientId: "<?php echo esc_js($client_id); ?>"
});
// Get cart total
const cartTotal = <?php echo WC()->cart ? WC()->cart->get_total('raw') : '0'; ?>;
acount.initiatePayment({
amount: cartTotal,
referenceNumber: "WC-ORDER-" + Date.now(),
onSuccess: function(result) {
console.log('Payment successful:', result);
// You can redirect to a custom success page or show a message
alert('Payment successful! Your order will be processed.');
// Optionally redirect to order received page
window.location.href = "<?php echo esc_url(wc_get_checkout_url()); ?>?payment_success=1";
},
onError: function(error) {
console.error('Payment failed:', error);
alert('Payment failed. Please try again or use a different payment method.');
}
});
});
}
});
</script>
<?php
}
}
}
add_action('woocommerce_checkout_after_customer_details', 'add_acountpay_checkout_button');
wp-content/plugins/acountpay-woocommerce/acountpay-woocommerce.php:Copy
<?php
/**
* Plugin Name: AcountPay for WooCommerce
* Description: Accept payments through AcountPay
* Version: 1.0.0
*/
if (!defined('ABSPATH')) {
exit;
}
class AcountPay_WooCommerce {
public function __construct() {
add_action('init', array($this, 'init'));
}
public function init() {
// Add payment gateway
add_filter('woocommerce_payment_gateways', array($this, 'add_gateway'));
// Enqueue scripts
add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
}
public function enqueue_scripts() {
if (is_checkout()) {
wp_enqueue_script(
'acountpay-sdk',
'https://cdn.acountpay.com/sdk/acount.umd.js',
array(),
'1.0.4',
true
);
}
}
public function add_gateway($gateways) {
$gateways[] = 'WC_AcountPay_Gateway';
return $gateways;
}
}
class WC_AcountPay_Gateway extends WC_Payment_Gateway {
public function __construct() {
$this->id = 'acountpay';
$this->method_title = 'AcountPay';
$this->method_description = 'Accept payments through AcountPay bank transfers';
$this->has_fields = true;
$this->init_form_fields();
$this->init_settings();
$this->title = $this->get_option('title');
$this->description = $this->get_option('description');
$this->client_id = $this->get_option('client_id');
add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
}
public function init_form_fields() {
$this->form_fields = array(
'enabled' => array(
'title' => 'Enable/Disable',
'type' => 'checkbox',
'label' => 'Enable AcountPay',
'default' => 'yes'
),
'title' => array(
'title' => 'Title',
'type' => 'text',
'default' => 'Pay with Bank Account'
),
'description' => array(
'title' => 'Description',
'type' => 'textarea',
'default' => 'Secure bank-to-bank payment via AcountPay'
),
'client_id' => array(
'title' => 'Client ID',
'type' => 'text',
'description' => 'Get this from your AcountPay dashboard'
)
);
}
public function payment_fields() {
echo '<div id="acountpay-payment-form">';
echo '<p>' . $this->description . '</p>';
echo '<button type="button" id="acountpay-pay-btn" class="button">Pay with Bank Account</button>';
echo '</div>';
?>
<script>
document.addEventListener('DOMContentLoaded', function() {
const payBtn = document.getElementById('acountpay-pay-btn');
if (payBtn) {
payBtn.addEventListener('click', function(e) {
e.preventDefault();
if (typeof Acount === 'undefined') {
alert('Payment system loading...');
return;
}
const acount = new Acount({
clientId: "<?php echo esc_js($this->client_id); ?>"
});
acount.initiatePayment({
amount: <?php echo WC()->cart->get_total('raw'); ?>,
referenceNumber: "WC-" + Date.now(),
onSuccess: function(result) {
// Set a flag and submit the form
jQuery('<input>').attr({
type: 'hidden',
name: 'acountpay_payment_success',
value: '1'
}).appendTo('form.checkout');
jQuery('form.checkout').submit();
},
onError: function(error) {
alert('Payment failed: ' + error.message);
}
});
});
}
});
</script>
<?php
}
public function process_payment($order_id) {
$order = wc_get_order($order_id);
// Check if payment was successful
if (isset($_POST['acountpay_payment_success']) && $_POST['acountpay_payment_success'] == '1') {
// Mark as processing or completed
$order->payment_complete();
$order->add_order_note('Payment completed via AcountPay');
// Clear cart
WC()->cart->empty_cart();
return array(
'result' => 'success',
'redirect' => $this->get_return_url($order)
);
}
return array(
'result' => 'failure',
'messages' => 'Payment was not completed'
);
}
}
new AcountPay_WooCommerce();
?>
- Go to WooCommerce → Settings → Payments
- Enable “AcountPay” and configure your Client ID
- Test with a sample order
Frontend Frameworks
- React
- Vue.js
- Next.js
- Angular
Installation:Implementation:Environment Variables:
Copy
npm i @acountpay/pis-sdk
Copy
// components/PaymentButton.tsx
import AcountPay from '@acountpay/pis-sdk';
export function PaymentButton() {
const handlePayment = async () => {
const acount = new AcountPay({
clientId: process.env.REACT_APP_ACOUNTPAY_CLIENT_ID!
});
await acount.initiateUserPaymentByEmail({
amount: 99.99,
requestId: 'ORDER-123',
callbackURL: `${window.location.origin}/payment-callback`
});
};
return (
<button onClick={handlePayment}>
Pay with AcountPay
</button>
);
}
Copy
# .env
REACT_APP_ACOUNTPAY_CLIENT_ID=your-client-id
Installation:Implementation:Environment Variables:
Copy
npm i @acountpay/pis-sdk
Copy
<template>
<button @click="handlePayment">Pay with AcountPay</button>
</template>
<script>
import AcountPay from '@acountpay/pis-sdk';
export default {
methods: {
async handlePayment() {
const acount = new AcountPay({
clientId: process.env.VUE_APP_ACOUNTPAY_CLIENT_ID
});
await acount.initiateUserPaymentByEmail({
amount: 99.99,
requestId: 'ORDER-123',
callbackURL: `${window.location.origin}/payment-callback`
});
}
}
};
</script>
Copy
# .env
VUE_APP_ACOUNTPAY_CLIENT_ID=your-client-id
Installation:Implementation:Environment Variables:
Copy
npm i @acountpay/pis-sdk
Copy
// pages/checkout.tsx
import { useEffect, useState } from 'react';
export default function Checkout() {
const [acount, setAcount] = useState<any>(null);
useEffect(() => {
// Dynamic import for client-side only
import('@acountpay/pis-sdk').then((module) => {
const AcountPay = module.default;
setAcount(new AcountPay({
clientId: process.env.NEXT_PUBLIC_ACOUNTPAY_CLIENT_ID!
}));
});
}, []);
const handlePayment = async () => {
if (acount) {
await acount.initiateUserPaymentByEmail({
amount: 99.99,
requestId: 'ORDER-123',
callbackURL: `${window.location.origin}/payment-callback`
});
}
};
return (
<button onClick={handlePayment} disabled={!acount}>
Pay with AcountPay
</button>
);
}
Copy
# .env.local
NEXT_PUBLIC_ACOUNTPAY_CLIENT_ID=your-client-id
Installation:Implementation:Environment Configuration:
Copy
npm i @acountpay/pis-sdk
Copy
// payment-button.component.ts
import { Component } from '@angular/core';
import AcountPay from '@acountpay/pis-sdk';
@Component({
selector: 'app-payment-button',
template: `
<button (click)="handlePayment()">
Pay with AcountPay
</button>
`
})
export class PaymentButtonComponent {
async handlePayment() {
const acount = new AcountPay({
clientId: environment.acountpayClientId
});
await acount.initiateUserPaymentByEmail({
amount: 99.99,
requestId: 'ORDER-123',
callbackURL: `${window.location.origin}/payment-callback`
});
}
}
Copy
// environments/environment.ts
export const environment = {
acountpayClientId: 'your-client-id'
};
Package Information
Contents
Contents
- Core payment flow utilities
- TypeScript definitions
- ESM/CJS/UMD builds for broad compatibility
- No embedded UI components (integrates with your existing design)
Browser Support
Browser Support
- Modern browsers with ES6 support
- Chrome 60+, Firefox 60+, Safari 12+, Edge 79+
Bundle Sizes
Bundle Sizes
- UMD: ~15KB gzipped
- ESM: ~12KB gzipped
- No external dependencies
Environment Variables
For framework integrations, set up environment variables:- React
- Vue.js
- Next.js
- Angular
Copy
# .env
REACT_APP_ACOUNTPAY_CLIENT_ID=your-client-id
Copy
# .env
VUE_APP_ACOUNTPAY_CLIENT_ID=your-client-id
Copy
# .env.local
NEXT_PUBLIC_ACOUNTPAY_CLIENT_ID=your-client-id
Copy
// environments/environment.tsd
export const environment = {
production: false,
acountpayClientId: 'your-client-id'
};
Important Notes
Global Constructor Name
Global Constructor Name
- NPM/ESM: Import as
AcountPay - UMD/Script Tag: Global constructor is
Acount(notAcountPay)
Client ID Setup
Client ID Setup
- Get your Client ID from AcountPay merchant dashboard
- Use sandbox Client ID for testing
- Switch to production Client ID for live payments
Version Pinning
Version Pinning
For production, pin to specific versions:
Copy
<!-- Pin to specific version -->
<script src="https://unpkg.com/@acountpay/[email protected]/dist/acount.umd.js"></script>
Next Steps
- Get Client ID: Sign up at merchant.acountpay.com
- Test Integration: Use sandbox Client ID for testing
- Go Live: Switch to production Client ID

