0.0.9 • Published 8 months ago

onah-payment-sdk v0.0.9

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

Onah Payment SDK User Guide

Collect payment on your web page using Onah Payment SDK

Installation

npm i onah-payment-sdk  
# or 
yarn add onah-payment-sdk

Usage

import the package

import {OnahSdk} from 'onah-payment-sdk';

Create a new OnahSdk instance

const onahSdk = new OnahSdk();

Then create a new transaction

    try {
      const createResponse = await onahSdk.createTransaction(
      {
        currency: "NGN",
        env: 'prod',
        amount: 1000,
        customer: {
          firstName: "John",
          lastName: "Doe10",
          email: "john@onah.africa",
          phoneNumber: "+234703000000",
          address: 'My address',
          city: 'Lagos',
          country: 'NG',
          state: 'Lagos',
          zipCode: '1234'
        },
        merchantId: '3Kv1p6r',
        metadata: {
          item: 'Iphone 14 pro'
        }
      },
    );
    // handle Payment success
    } catch (err) {
      // handle payment failed or cancelled
    }

Properties

PropertyDescriptionTypeRequiredData type
currencyTransaction currencyNGNNOstring
 amountAmount to be chargedN/AYESnumber
merchantIdThe Onah Id assigned to your accountN/AYESstring
envThe sdk EnvironmentprodNOprod | sandbox
metadataAn object you can send data like product name item to your dashboardN/ANOobject
customerThe customer object creates a new customer on your dashboardN/ANOobject
customerIdInstead of creating a new customer you can send existing customer IdN/ANOstring

metadata

The metadata property is an optional field that allows you to add additional information about their transactions in key value pairs format. This data will also be | Property | Description | Default Value | Required | Data type | | --- | --- | --- | --- | --- | | item | A simple description / name of product which the transaction belongs to | N/A | NO | string

customer

The customer property is an optional field that allows you to create a new customer | Property | Description | Default Value | Required | Data type | | --- | --- | --- | --- | --- | | address | Customer Address | N/A | YES | string | | city | Customer City | N/A | YES | string | | country | Customer country | N/A | YES | string | | email | Customer email (A unique value) | N/A | YES | string | | firstName | Customer first name | N/A | YES | string | | lastName | Customer last name | N/A | YES | string | | phoneNumber | Customer phone number (A unique value) | N/A | YES | string | | state | Customer state | N/A | YES | string | | zipCode | Customer zip code | N/A | YES | string |

0.0.8-beta

8 months ago

0.0.7-beta

8 months ago

0.0.9

8 months ago

0.0.8

8 months ago

0.0.4-rc

8 months ago

0.0.6-rc

8 months ago

0.0.5-rc

8 months ago

0.0.2

8 months ago

0.0.1

8 months ago