Skip to main content
Before installing the SDK, ensure you have:
  • 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. For fastest setup, use our CDN:
<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

npm i @acountpay/pis-sdk

Yarn Installation

yarn add @acountpay/pis-sdk

Usage Methods

import AcountPay from '@acountpay/pis-sdk';

const acount = new AcountPay({ 
  clientId: 'your-client-id' 
});
<script src="/node_modules/@acountpay/pis-sdk/dist/acount.umd.js"></script>
<script>
  const acount = new Acount({ 
    clientId: 'your-client-id' 
  });
</script>
<script src="https://unpkg.com/@acountpay/pis-sdk@1.0.0/dist/acount.umd.js"></script>
<script>
  const acount = new Acount({ 
    clientId: 'your-client-id' 
  });
</script>

Platform-Specific Integration

The examples below cover JavaScript frameworks (React, Next.js, Vue, Angular) for custom sites and SPAs. Load the SDK from the CDN or your bundler as shown in Usage Methods, then follow the pattern for your stack.

JavaScript Frameworks

Installation:
npm i @acountpay/pis-sdk
Implementation:
// components/PaymentButton.tsx
'use client';
import { useState } from 'react';
import AcountPay from '@acountpay/pis-sdk';

export function PaymentButton({ amount, orderId }: { amount: number; orderId: string }) {
  const [loading, setLoading] = useState(false);

  const handlePayment = async () => {
    setLoading(true);
    try {
      const acount = new AcountPay({
        clientId: process.env.NEXT_PUBLIC_ACOUNTPAY_CLIENT_ID!
      });

      const { redirectUrl } = await acount.createPaymentLink({
        amount,
        referenceNumber: orderId,
        redirectUrl: `${window.location.origin}/payment-callback?orderId=${orderId}`,
      });

      window.location.href = redirectUrl;
    } catch (error) {
      console.error('Payment failed:', error);
      setLoading(false);
    }
  };

  return (
    <button onClick={handlePayment} disabled={loading}>
      {loading ? 'Processing...' : 'Pay with AcountPay'}
    </button>
  );
}
Environment Variables:
# .env.local
NEXT_PUBLIC_ACOUNTPAY_CLIENT_ID=your-client-id

Package Information

  • Core payment flow utilities
  • TypeScript definitions
  • ESM/CJS/UMD builds for broad compatibility
  • No embedded UI components (integrates with your existing design)
  • Modern browsers with ES6 support
  • Chrome 60+, Firefox 60+, Safari 12+, Edge 79+
  • UMD: ~15KB gzipped
  • ESM: ~12KB gzipped
  • No external dependencies

Environment Variables

For framework integrations, set up environment variables:
# .env
REACT_APP_ACOUNTPAY_CLIENT_ID=your-client-id

Important Notes

  • NPM/ESM: Import as AcountPay
  • UMD/Script Tag: Global constructor is Acount (not AcountPay)
  1. Get your Client ID from AcountPay merchant dashboard
  2. Use sandbox Client ID for testing
  3. Switch to production Client ID for live payments
For production, pin to specific versions:
<!-- Pin to specific version -->
<script src="https://unpkg.com/@acountpay/pis-sdk@1.0.4/dist/acount.umd.js"></script>

Next Steps

  1. Get Client ID: Sign up at merchant.acountpay.com
  2. Test Integration: Use sandbox Client ID for testing
  3. Go Live: Switch to production Client ID
See Setup SDK for detailed configuration and Initialize Payment for implementation examples.