This is the official TypeScript Node.js SDK for the ZuriPay payment gateway.
npm install zuripayimport { ZuriPay } from 'zuripay';
const zuriPay = new ZuriPay('YOUR_API_KEY');const paymentResponse = await zuriPay.transactions.initiatePayment({
amount: 1000,
email: 'customer@example.com',
currency: 'USD',
transaction_reference: 'ZURIPAY1234567890',
success_url: 'https://yourwebsite.com/success',
failure_url: 'https://yourwebsite.com/failure'
});const verifyResponse = await zuriPay.transactions.verifyPayment({ transaction_reference: 'TRANSACTION_REFERENCE' });const customerResponse = await zuriPay.customers.createCustomer({
first_name: 'John',
last_name: 'Doe',
street: '123 Main St',
city: 'Harare',
state: 'Harare',
country: 'Zimbabwe',
postal_code: '00263',
emails: [{ email_address: 'john.doe@example.com', is_primary: true }],
phones: [{ phone_number: '+263771234567', is_primary: true }]
});const listCustomersResponse = await zuriPay.customers.listCustomers({ limit: 10, skip: 0 });const getCustomerResponse = await zuriPay.customers.getCustomer('CUSTOMER_ID_OR_REFERENCE');const updateCustomerResponse = await zuriPay.customers.updateCustomer('CUSTOMER_ID_OR_REFERENCE', {
first_name: 'Jane',
emails: [{ email_address: 'jane.doe@example.com', is_primary: true }]
});const initiatePayoutResponse = await zuriPay.payouts.initiatePayout('CUSTOMER_ID', 'bank_transfer', 1000, 'USD');const listPayoutsResponse = await zuriPay.payouts.listPayouts();const getPayoutResponse = await zuriPay.payouts.getPayout('PAYOUT_REQUEST_ID');const updatePayoutResponse = await zuriPay.payouts.updatePayout('PAYOUT_REQUEST_ID', 'approved');const deletePayoutResponse = await zuriPay.payouts.deletePayout('PAYOUT_REQUEST_ID');const createCallbackResponse = await zuriPay.callbacks.createCallback({
url: 'https://example.com/webhooks/payments',
description: 'Payment notification endpoint',
events: 'payment.created,payment.updated,payment.completed'
});const listCallbacksResponse = await zuriPay.callbacks.listCallbacks({ limit: 10, skip: 0 });const getCallbackResponse = await zuriPay.callbacks.getCallback('CALLBACK_ID');const updateCallbackResponse = await zuriPay.callbacks.updateCallback('CALLBACK_ID', {
url: 'https://example.com/webhooks/payments/v2',
events: 'payment.created,payment.updated,payment.completed,payment.failed',
is_active: true
});const deleteCallbackResponse = await zuriPay.callbacks.deleteCallback('CALLBACK_ID');const createPaymentLinkResponse = await zuriPay.paymentLinks.createPaymentLink({
amount: 100.00,
currency: 'USD'
});const listPaymentLinksResponse = await zuriPay.paymentLinks.listPaymentLinks({ limit: 10, start_date: '2023-01-01' });const getPaymentLinkResponse = await zuriPay.paymentLinks.getPaymentLink('PAYMENT_LINK_ID');const updatePaymentLinkResponse = await zuriPay.paymentLinks.updatePaymentLink({
payment_link_id: 'PAYMENT_LINK_ID',
amount: 150.00,
status: 'inactive'
});const deletePaymentLinkResponse = await zuriPay.paymentLinks.deletePaymentLink('PAYMENT_LINK_ID');const createWalletResponse = await zuriPay.wallets.createWallet({
currency: 'USD',
country: 'ZW'
});const listWalletsResponse = await zuriPay.wallets.listWallets({ limit: 10, start_date: '2023-01-01' });const getWalletResponse = await zuriPay.wallets.getWallet('WALLET_ID');const getWalletBalanceResponse = await zuriPay.wallets.getWalletBalance('USD');const deleteWalletResponse = await zuriPay.wallets.deleteWallet('WALLET_ID');Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License.