Skip to main content
Home

A korapay client SDK for the javascript runtime.

This package works with Cloudflare Workers, Node.js, Deno, Bun
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score
76%
Published
4 months ago (0.3.0)

@gray-adeyi/korapay-sdk

A korapay client SDK for the javascript runtime.

Features

  • Typescript support
  • Implements methods matching all of korapay's public API.
  • Automatic case transformation of payload and response data keys for a more optimal JS/TS experience

Installation

Npm

npm i @gray-adeyi/korapay-sdk

Yarn

yarn add @gray-adeyi/korapay-sdk

Pnpm

pnpm i @gray-adeyi/korapay-sdk

Bun

bun add @gray-adeyi/korapay-sdk

Deno

deno add @gray-adeyi/korapay-sdk

Usage

import {
  type ChargeViaBankTransferPayload,
  Currency,
  KorapayClient,
  type KorapayResponse,
} from "@gray-adeyi/korapay-sdk";

// Assumes your KORAPAY_PUBLIC_KEY, KORAPAY_SECRET_KEY
// & KORAPAY_ENCRYPTION_KEY is set in your environmental
// variables. They can be passed in explicitly on the
// instantiation which overrides the values set in the environmental
// variables.
const client = new KorapayClient();

const response: KorapayResponse = await client.getBalances();

const payload: ChargeViaBankTransferPayload = {
  reference: "qwerty",
  customer: { email: "johndoe@example.com" },
  amount: 1_000_000,
  currency: Currency.NGN,
  narration: "test charge",
};
client.chargeViaBankTransfer(payload).then(console.log);

See the Project's Documentation for more

Limitations

  • Currently, @gray-adeyi/korapay-sdk does not perform any form of validation on the data passed in as method parameters but sends them as is to korapay's servers.
  • Limited documentation

Sponsorship

Every little donation goes a long way. You can also give this project a star in its Github repository it helps ♥️

Contributing

You might encounter bugs while using this project or have feature enhancements you'd like to share with the project. Create an issue on the project's github page.

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@gray-adeyi/korapay-sdk

Import symbol

import * as korapay_sdk from "@gray-adeyi/korapay-sdk";
or

Import directly with a jsr specifier

import * as korapay_sdk from "jsr:@gray-adeyi/korapay-sdk";

Add Package

pnpm i jsr:@gray-adeyi/korapay-sdk
or (using pnpm 10.8 or older)
pnpm dlx jsr add @gray-adeyi/korapay-sdk

Import symbol

import * as korapay_sdk from "@gray-adeyi/korapay-sdk";

Add Package

yarn add jsr:@gray-adeyi/korapay-sdk
or (using Yarn 4.8 or older)
yarn dlx jsr add @gray-adeyi/korapay-sdk

Import symbol

import * as korapay_sdk from "@gray-adeyi/korapay-sdk";

Add Package

vlt install jsr:@gray-adeyi/korapay-sdk

Import symbol

import * as korapay_sdk from "@gray-adeyi/korapay-sdk";

Add Package

npx jsr add @gray-adeyi/korapay-sdk

Import symbol

import * as korapay_sdk from "@gray-adeyi/korapay-sdk";

Add Package

bunx jsr add @gray-adeyi/korapay-sdk

Import symbol

import * as korapay_sdk from "@gray-adeyi/korapay-sdk";