Skip to main content
This guides demonstrate how to use Swervpay NodeJS SDK to integrate Swervpay into your NodeJS application.

Setup

Make sure you have create a Swervpay business and have your API keys ready. Don’t forget to check our recommended go live checklist.

Install the SDK

Install swervpay-node sdk into your new or existing NodeJS application using any of your favorite package manager.
$ npm install @swervpaydev/sdk

Usage

NodeJS
import { SwervpayClient } from "@swervpaydev/sdk";

const config = {
    secretKey: "<SECRET_KEY>",
    businessId: "<BUSINESS_ID>"
}

const swervpay = new SwervpayClient(config);

// Create a new customer
await swervpay.customer.create({
    firstname: "user",
    lastname: "user",
    middlename: "user",
    country: "user",
    email: "[email protected]"
})

// Create a new card
await swervpay.card.create({
    customer_id: "user",
    amount: 10,
    currency: "USD",
    provider: "MASTERCARD",
    type: "DEFAULT"
})

// Create a USD collection account for a customer
await swervpay.collection.create({
    customer_id: "user",
    currency: "USD",
    merchant_name: "Ada Okafor",
    amount: 0,
    type: "DEFAULT",
    additional_information: {
        account_type: "INDIVIDUAL",
        nin: "12345678901",
        tax_number: "12345678901",
        date_of_birth: "1994-04-12",
        employment_status: "EMPLOYED",
        account_designation: "PERSONAL",
        income_band: "UNDER_10000",
        source_of_income: "SALARY",
        address: {
            street: "12 Admiralty Way",
            city: "Lagos",
            state: "Lagos",
            country: "Nigeria",
            zip_code: "100001"
        },
        document: {
            type: "NIN",
            number: "12345678901",
            issue_date: "2020-01-01",
            expiry_date: "2030-01-01",
            urls: ["https://example.com/document-front.jpg"]
        },
        utility_bill: "https://example.com/utility-bill.pdf",
        bank_statement: "https://example.com/bank-statement.pdf"
    }
})

// Create a new payout
await swervpay.payout.create({
    bank_code: "user",
    account_number: "user",
    amount: "user",
    currency: "NGN",
    reference: "user",
    narration: "user"
})
Here, we initialize the Swervpay client with our secret key and business id. Then we create a new customer, card, USD collection account, and payout.

Next Steps

Other SDKs