$ npm install @swervpaydev/sdk
$ yarn add @swervpaydev/sdk
$ pnpm add @swervpaydev/sdk
$ bun install @swervpaydev/sdk
Create swervpay instance with your Business ID and secret.
import { SwervpayClient } from "@swervpaydev/sdk";
const swervpay = new SwervpayClient({
businessId: process.env.SWERVPAY_API_KEY!,
secretKey: process.env.SWERVPAY_API_SECRET!,
logLevel: "debug",
});
const payout = await swervpay.payout.create({
amount: req.body.amount,
currency: req.body.currency,
bank_code: req.body.bank_code,
account_number: req.body.account_number,
naration: req.body.narration,
email: req.body.email,
reference: req.body.reference,
});
const payout = await swervpay.payout.get(req.param.id);
const transactions = await swervpay.transaction.gets({
limit: parseInt(req.query.limit as string),
page: parseInt(req.query.page as string),
});
const transaction = await swervpay.transaction.get(req.param.id);
const customer = await swervpay.customer.create({
firstname: req.body.first_name,
lastname: req.body.last_name,
email: req.body.email,
middlename: "",
country: req.body.country,
});
const customer = await swervpay.customer.update(req.params.id, {
email: req.body.email,
phone_number: req.body.phone_number,
});
const customer = await swervpay.customer.kyc(req.params.id, {
tier: req.body.tier as "ONE" | "TWO" | "FULL",
document: {
document_type: req.body.document_type,
document: req.body.document,
passport: req.body.passport,
document_number: req.body.document_number,
},
information: {
address: req.body.address,
city: req.body.city,
bvn: req.body.bvn,
state: req.body.state,
country: req.body.country,
postal_code: req.body.postal_code,
},
});
const customers = await swervpay.customer.gets({
limit: parseInt(req.query.limit as string),
page: parseInt(req.query.page as string),
});
const customer = await swervpay.customer.get(req.param.id);
const card = await swervpay.card.create({
amount: req.body.amount,
currency: req.body.currency,
customer_id: req.body.customer_id,
type: req.body.type as "LITE" | "DEFAULT" | "COOPERATE",
issuer: req.body.issuer as "MASTERCARD" | "VISA",
name_on_card: req.body.name_on_card,
});
const cards = await swervpay.card.gets({
limit: parseInt(req.query.limit as string),
page: parseInt(req.query.page as string),
});
const card = await swervpay.card.get(req.param.id);
await swervpay.webhook.test(req.params.id);
await swervpay.webhook.retry(req.params.id);
const banks = await swervpay.other.banks();
const result = await swervpay.other.resolve_account_number({
bank_code: req.body.bank_code as string,
account_number: req.body.account_number as string,
});
const result = await swervpay.fx.rate({
from: req.body.bank_code as string,
to: req.body.account_number as string,
amount: req.body.amount as number,
});
const result = await swervpay.fx.rate({
from: req.body.bank_code as string,
to: req.body.account_number as string,
amount: req.body.amount as number,
});
const wallet = await swervpay.wallet.get(req.params.id);
const wallets = await swervpay.wallet.gets({
limit: parseInt(req.query.limit as string),
page: parseInt(req.query.page as string),
});