SDKs

Official client libraries for integrating with RAPI in your preferred programming language.

Available SDKs

JS

Node.js

v2.0.3

npm install @karatdollar/sdkView on GitHub
PY

Python

v2.0.1

pip install karatdollarView on GitHub
GO

Go

v2.0.0

go get github.com/karatdollar/kad-goView on GitHub
RB

Ruby

v2.0.0

gem install karatdollarView on GitHub
PHP

PHP

v2.0.1

composer require karatdollar/sdkView on GitHub
JV

Java

v2.0.0

implementation 'com.karatdollar:sdk:2.0.0'View on GitHub

Node.js SDK

Installation

1# Using npm
2npm install @karatdollar/sdk
3
4# Using yarn
5yarn add @karatdollar/sdk
6
7# Using pnpm
8pnpm add @karatdollar/sdk

Usage

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';
2
3// Initialize with your API key
4const kad = new KaratDollar('sk_live_your_api_key_here');
5
6// Initiate a payment
7const 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});
14
15console.log('Checkout URL:', payment.checkoutUrl);
16console.log('Payment ID:', payment.paymentId);
17
18// Check payment status
19const status = await kad.payments.getStatus(payment.paymentId);
20console.log('Status:', status.status);
21
22// Get FX rate
23const rate = await kad.fx.getRate({ from: 'KAD', to: 'ZAR' });
24console.log('KAD/ZAR:', rate.rate);
25
26// Apply for BNPL
27const bnpl = await kad.bnpl.apply({
28 customerId: 'cust_abc123',
29 amount: 5000,
30 merchantId: 'merch_xyz789',
31 planType: 'pay_in_4',
32});
33
34console.log('Approved:', bnpl.approved);
35console.log('Credit Limit:', bnpl.creditLimit);
36
37// Issue a virtual card
38const card = await kad.cards.issue({
39 customerId: 'cust_abc123',
40 cardType: 'reloadable',
41 network: 'visa',
42 currency: 'ZAR',
43 spendingLimit: 50000,
44});
45
46console.log('Card Number:', card.maskedNumber);

Resources