Registry / payments / cpay-node-api-sdk

cpay-node-api-sdk

JSON →
library2.1.1jsnpmunverified

A TypeScript SDK for interacting with the Cpay REST API (version 2.1.1), providing convenient methods for authentication, wallet management (including multi-currency and deposit wallets), and withdrawals (including NFTs and internal transfers). It supports both v1 and v2 wallet versions. Ideal for Node.js applications needing seamless integration with Cpay payment infrastructure.

npm install cpay-node-api-sdk
INSTALL
IMPORT
SIG · CPAY-NODE-API-SDK
C
cpay-node-api-sdk
paymentsjavascriptv2.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CpaySDK
import CpaySDK from 'cpay-node-api-sdk';
import { CpaySDK } from 'cpay-node-api-sdk';
Default export, not named. Must use default import.
CpaySDK
const CpaySDK = require('cpay-node-api-sdk');
const { CpaySDK } = require('cpay-node-api-sdk');
CommonJS require returns the default export directly, not an object.
types
import type { WalletOptions } from 'cpay-node-api-sdk';
import { WalletOptions } from 'cpay-node-api-sdk';
Use type-only import for compile-time types to avoid runtime overhead.

Demonstrates initialization, authentication, wallet creation, and fee estimation – core Cpay operations.

import CpaySDK from 'cpay-node-api-sdk'; const cpay = new CpaySDK({ publicKey: process.env.CPAY_PUBLIC_KEY ?? '', privateKey: process.env.CPAY_PRIVATE_KEY ?? '', walletId: process.env.CPAY_WALLET_ID, passphrase: process.env.CPAY_PASSPHRASE, }); async function main() { // Register a new account const account = await cpay.auth.register({ email: 'user@example.com', password: 'securePassword123', roles: ['merchant'], }); console.log('Account created:', account); // Deposit wallet const wallet = await cpay.wallet.createDepositWallet({ currencyId: '1', walletVersion: 'v2', }); console.log('Deposit wallet:', wallet); // Withdrawal const fee = await cpay.withdrawal.estimateFee({ to: 'recipient-address', amount: '0.01', }); console.log('Estimated fee:', fee); } main().catch(console.error);
Debug
Known issues
breakingWallet v2 response shape differs from v1; accessing fields that only exist in v1 may return undefined.
fix
Check walletVersion and handle response fields accordingly.
affects: >=2.0.0
gotchawalletId and passphrase are required for most withdrawal and wallet info methods but not passed as parameters; they are set during SDK initialization.
fix
Ensure walletId and passphrase are provided in the options object when constructing CpaySDK.
affects: >=2.0.0
gotchaThe createDepositWallet and createMulticurrencyWallets methods may return sensitive data (privateKey, mnemonic). Handle with care and never log or expose them.
fix
Store private keys securely and avoid printing them.
affects: >=2.0.0
deprecatedSupport for v1 wallet endpoints may be deprecated in future versions. Use v2 for new integrations.
fix
Set walletVersion to 'v2' in wallet creation options.
affects: >=2.0.0 <3.0.0
Errors
Common errors & fixes
TypeError: cpay.auth.register is not a function
Forgot to instantiate CpaySDK with new keyword or used named export.
fix
Use: const cpay = new CpaySDK(options);
Error: walletId is required
Missing walletId in SDK initialization for methods that require it.
fix
Pass walletId in the options object: new CpaySDK({ ..., walletId: 'your-wallet-id' })
Upgrade
Version history
2.1.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
44 hits · last 30 days
node
38
OpenAI (training)
2
Resources
cpay-node-api-sdk — npm install cpay-node-api-sdk · libregistry