This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

icad-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.0.16 • Public • Published

IcadPay SDK for JavaScript

The IcadPay SDK simplifies payment integration for your application, enabling seamless processing of card payments, USSD transactions, QR code payments, and bank transfers. This SDK provides secure and efficient payment solutions to enhance your app's capabilities.


Features

  • Card Payments: Encrypt card details and securely process payments with OTP verification.
  • USSD Payments: Fetch banks, initiate USSD payments, and verify transactions.
  • QR Code Payments: Generate dynamic QR codes for transactions.
  • Bank Transfers: Create virtual accounts and verify transfer transactions.
  • Easy integration with a modular, developer-friendly interface.

Installation

Install the SDK via npm:

npm install icadpay-sdk

Quick Start

Initialize the SDK

import IcadPaySDK from "icadpay-sdk";

const sdk = new IcadPaySDK({
  publicKey: "your-public-key", // Replace with your public key
  apiKey: "your-api-key",       // Replace with your API key
  environment: "sandbox",       // Use "sandbox" or "production"
});

Card Payment Example

sdk.card
  .makePayment(
    {
      pan: "1234 5678 9876 5432", // Card number
      cvv: "123",                 // CVV
      expiryDate: "12/25",        // MM/YY
      pin: "1234",                // Card PIN
    },
    {
      amount: 5000,               // Amount in minor units (e.g., kobo for NGN)
      customerId: "user@example.com",
      transactionRef: "uniqueRef123",
    }
  )
  .then(response => {
    console.log("Payment Response:", response);
  })
  .catch(error => {
    console.error("Payment Error:", error.message);
  });

USSD Payment Example

sdk.ussd
  .getBanks()
  .then(banks => {
    console.log("Available Banks:", banks);
  })
  .catch(error => {
    console.error("Error Fetching Banks:", error.message);
  });

sdk.ussd
  .initiatePayment({
    amount: 5000,
    reference: "uniqueRef123",
    bankCode: "123", // Replace with a valid bank code
    isBill: false,
  })
  .then(response => {
    console.log("USSD Payment Initiated:", response);
  })
  .catch(error => {
    console.error("USSD Payment Error:", error.message);
  });

QR Code Payment Example

sdk.qr
  .initiatePayment(5000) // Amount in minor units (e.g., kobo for NGN)
  .then(response => {
    console.log("QR Code Payment Data:", response);
  })
  .catch(error => {
    console.error("QR Payment Error:", error.message);
  });

Bank Transfer Example

sdk.bankTransfer
  .createVirtualAccount({
    transaction: {
      amount: 5000, // Amount in minor units (e.g., kobo for NGN)
      customer: {
        firstname: "John",
        surname: "Doe",
        email: "john.doe@example.com",
        mobile_no: "+2347012345678",
      },
    },
  })
  .then(response => {
    console.log("Virtual Account Created:", response);
  })
  .catch(error => {
    console.error("Bank Transfer Error:", error.message);
  });

Configuration

The SDK supports the following configurations:

Parameter Type Description
publicKey String Your public key for encryption.
apiKey String Your API key for authentication.
environment String Set to "sandbox" for testing or "production" for live transactions.

Error Handling

All SDK methods return Promises. Use .catch() to handle errors:

sdk.card
  .makePayment(cardDetails, transactionDetails)
  .catch(error => {
    console.error("Error Message:", error.message);
  });

Testing

  1. Clone this repository.
  2. Run tests using your test framework (e.g., Jest or Mocha).

Contributing

We welcome contributions! To contribute:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Commit your changes and push the branch.
  4. Submit a pull request.

License

This project is licensed under the MIT License.


Support

If you have questions or need assistance, reach out to our support team:


Feel free to customize this template further to suit your brand and SDK requirements.

Readme

Keywords

none

Package Sidebar

Install

npm i icad-sdk

Weekly Downloads

0

Version

1.0.16

License

ISC

Unpacked Size

153 kB

Total Files

19

Last publish

Collaborators

  • jaycruzerville