Installation
Install the backend SDK first. Add the React SDK only when you need to render payment fields directly in your frontend.
Node SDK
Requires Node.js >=18.
npm install @accrupay/node
Imports
ESM (default):
import AccruPay, { TRANSACTION_PROVIDER, CURRENCY, COUNTRY_ISO_2 } from '@accrupay/node';
CommonJS:
const { default: AccruPay, TRANSACTION_PROVIDER, CURRENCY, COUNTRY_ISO_2 } = require('@accrupay/node');
Exported symbols
| Export | Type | Description |
|---|---|---|
AccruPay | class (default) | SDK client — instantiate once per process |
TRANSACTION_PROVIDER | enum | Identifies which provider to route a session through |
CURRENCY | enum | ISO 4217 currency codes (USD, EUR, …) |
COUNTRY_ISO_2 | enum | ISO 3166-1 alpha-2 country codes (US, GB, …) |
note
TRANSACTION_PROVIDER values correspond to providers configured in your AccruPay merchant account. The enum contains only the providers AccruPay currently supports — your account controls which ones are active.
React SDK
Requires React >=16.8 (hooks). Install as a frontend dependency.
npm install @accrupay/react
Named exports
import {
AccruPay, // Context provider — wraps your checkout
CardNumber, // PCI-scoped card number field
CardExpiry, // Expiry date field
CardCVC, // CVC / CVV field
CardholderName, // Cardholder name field
SubmitButton, // Triggers provider-side payment submission
useAccruPay, // Hook — access session state and errors inside the provider
} from '@accrupay/react';
warning
The React SDK authenticates with merchantPublicId — a public identifier safe for the browser. Never pass your apiSecret to the React SDK or any frontend code.
What to install
| You need | Install |
|---|---|
| Create sessions, verify payments, charge stored methods | @accrupay/node |
| Render payment fields in your checkout UI | @accrupay/react |
| Both (standard full integration) | Both packages |
| Custom UI against the raw API | Neither — use the GraphQL API directly |