
SDKs
Official client libraries for integrating with RAPI in your preferred programming language.
Available SDKs
Node.js SDK
Installation
1# Using npm2npm install @karatdollar/sdk34# Using yarn5yarn add @karatdollar/sdk67# Using pnpm8pnpm add @karatdollar/sdkUsage
The Node.js SDK provides a typed, Promise-based interface for all RAPI v2 endpoints. Full TypeScript support is included out of the box.
1import { KaratDollar } from '@karatdollar/sdk';23// Initialize with your API key4const kad = new KaratDollar('sk_live_your_api_key_here');56// Initiate a payment7const payment = await kad.payments.initiate({8 amount: 15000,9 currency: 'KAD',10 reference: 'order_12345',11 description: 'Premium subscription',12 callbackUrl: 'https://yourapp.com/webhooks/kad',13});1415console.log('Checkout URL:', payment.checkoutUrl);16console.log('Payment ID:', payment.paymentId);1718// Check payment status19const status = await kad.payments.getStatus(payment.paymentId);20console.log('Status:', status.status);2122// Get FX rate23const rate = await kad.fx.getRate({ from: 'KAD', to: 'ZAR' });24console.log('KAD/ZAR:', rate.rate);2526// Apply for BNPL27const bnpl = await kad.bnpl.apply({28 customerId: 'cust_abc123',29 amount: 5000,30 merchantId: 'merch_xyz789',31 planType: 'pay_in_4',32});3334console.log('Approved:', bnpl.approved);35console.log('Credit Limit:', bnpl.creditLimit);3637// Issue a virtual card38const card = await kad.cards.issue({39 customerId: 'cust_abc123',40 cardType: 'reloadable',41 network: 'visa',42 currency: 'ZAR',43 spendingLimit: 50000,44});4546console.log('Card Number:', card.maskedNumber);