From d280729ca3ad45bae89a7cda86c2f24d0f68d641 Mon Sep 17 00:00:00 2001 From: Amaka Ijere Date: Fri, 11 Apr 2025 12:18:17 +0100 Subject: [PATCH] Update Documentation: added full name and tokenize fields --- README.md | 63 +++++++++++++++++++--------- package.json | 2 +- samples/standard/standardCheckout.js | 38 +++++++++-------- src/typings/request/IStandard.ts | 4 +- 4 files changed, 67 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index a1d358c..407e81f 100644 --- a/README.md +++ b/README.md @@ -2,47 +2,53 @@ -

SeerBit

- -# SeerBit's API SDK for NodeJS +# SeerBit's API SDK for NodeJS SeerBit NodeJS SDK for easy integration with SeerBit's API. ## Integration + The Library supports all APIs under the following services: -* [x] standard checkout -* [x] recurrent payment -* [x] pre-auth payment -* [x] mobile money payment -* [x] card payments -* [x] order service +- [x] standard checkout +- [x] recurrent payment +- [x] pre-auth payment +- [x] mobile money payment +- [x] card payments +- [x] order service ## Requirements -* Node 10 or higher + +- Node 14 or higher ## Installation ```bash npm install --save seerbit-nodejs +OR + yarn add --save seerbit-nodejs -``` -#### You can find both public and secret keys from your merchant dashboard. +OR -Your merchant account token can be generated following the guides [here](https://doc.seerbit.com/getstarted/authentication) +pnpm install --save seerbit-nodejs +``` +#### You can find both public and secret keys from your merchant dashboard. + +Your merchant account token can be generated following the guides [here](https://doc.seerbit.com/development-resources/key-encryption) ## Usage ### Standard Checkout -``` js + +```js const {Client, Config, StandardCheckout} = require("seerbit-nodejs"); const {SeerBitConfig} = require("../config"); const config = new Config( @@ -61,6 +67,8 @@ const payload = { currency: "NGN", email:"testmerchant@mail.com", paymentReference: Date.now() + fullName: "Test Name" + tokenize: false } standard.Initialize(payload) @@ -68,17 +76,32 @@ standard.Initialize(payload) .catch(e=>console.log(e)) ``` -You can find more usage in the [samples](samples) folder +You can find more usage in the [samples](samples) folder + +## Properties +| Property | Type | Required | Desc | +| ---------------- | -------------------- | -------- | -------------------------------------------------------- | +| currency | `String` | Optional | The currency for the transaction e.g NGN | +| email | `String` | Required | The email of the user to be charged | +| fullName | `String` | Optional | The fullname of the user to be charged | +| country | `String` | Optional | Transaction country which can be optional | +| amount | `String` | Required | The transaction amount in kobo | +| publicKey | `String` | Required | Your Public key or see above step to get yours | +| tokenize | `bool` | Optional | Tokenize card | +| paymentReference | `String` or `Number` | Required | Set a unique transaction reference for every transaction | -## API Documentation ## -* https://doc.seerbit.com/ +## API Documentation + +- https://doc.seerbit.com/ ## Contributing + We strongly encourage you to join us in contributing to this repository so everyone can benefit from: -* New features and functionality -* Resolved bug fixes and issues -* Any general improvements + +- New features and functionality +- Resolved bug fixes and issues +- Any general improvements ## License diff --git a/package.json b/package.json index 7455d41..67144a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "seerbit-nodejs", - "version": "0.3.0", + "version": "0.4.0", "description": "SeerBit NodsJS SDK", "main": "lib/src/index.js", "types": "lib/src/index.d.ts", diff --git a/samples/standard/standardCheckout.js b/samples/standard/standardCheckout.js index 02ca242..cc2ef0d 100644 --- a/samples/standard/standardCheckout.js +++ b/samples/standard/standardCheckout.js @@ -1,23 +1,25 @@ -const {Client, Config, StandardCheckout} = require("seerbit-nodejs"); -const {SeerBitConfig} = require("../config"); -const config = new Config( - { - publicKey: SeerBitConfig.PUBLIC_KEY, - secretKey: SeerBitConfig.SECRET_KEY, - bearerToken: SeerBitConfig.TOKEN - }); +const { Client, Config, StandardCheckout } = require("seerbit-nodejs"); +const { SeerBitConfig } = require("../config"); +const config = new Config({ + publicKey: SeerBitConfig.PUBLIC_KEY, + secretKey: SeerBitConfig.SECRET_KEY, + bearerToken: SeerBitConfig.TOKEN, +}); const client = new Client(config); const standard = new StandardCheckout(client); const payload = { - amount:100, - callbackUrl: "www.testapp.com", - country: "NG", - currency: "NGN", - email:"testmerchant@mailinator.com", - paymentReference: Date.now() -} + amount: 100, + callbackUrl: "www.testapp.com", + country: "NG", + currency: "NGN", + email: "testmerchant@mailinator.com", + paymentReference: Date.now(), + fullName: "Test Name", + tokenize: false, +}; -standard.Initialize(payload) - .then(res=>console.log(res)) - .catch(e=>console.log(e)) +standard + .Initialize(payload) + .then((res) => console.log(res)) + .catch((e) => console.log(e)); diff --git a/src/typings/request/IStandard.ts b/src/typings/request/IStandard.ts index 80154a4..247c80d 100644 --- a/src/typings/request/IStandard.ts +++ b/src/typings/request/IStandard.ts @@ -11,7 +11,9 @@ declare namespace IStandard{ productId?: string | null, hash: string, hashType?: string, - publicKey?: string + publicKey?: string, + fullName: string, + tokenize: boolean } export interface InitializeResponse {