1.1.2 • Published 5 years ago

asoriba-payment v1.1.2

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

Asoriba Payment Platform

This is a node wrapper of the asoriba payment platform. It allows for initializing payment or creating the asoriba checkout page

Installation

npm i asoriba-payment

Checkout Page

This section shows how to create a checkout page with asoriba's payment api

FIELDDESCRIPTIONREQUIREDDATA TYPE
AUTH_TOKENAuthentication token required to make a succesful call to the asoriba apitruestring
BASE_URLBase url for the http asoriba api. It could be that of the live api or the stage apitruestring
PAYMENT DETAILSContains the details of the payment or ordertrueobject

Run

Initialize Payment / Checkout

const payment = require ('asoriba-payment')

const AUTH_TOKEN = "dsdfsdfsdfdfsfsf"
const BASE_URL = "https://paymentsandbox.asoriba.com"

const orderDetails = {
  amount: 1.0,
  metadata: {
    order_id: 9800,
    product_name: 'Title of product/service/donation',
    product_description: 'Description of product/service/donation'
  },
  callback: 'https://435c02e7.ngrok.io/kipln/callback',
  post_url: 'https://435c02e7.ngrok.io/kipln',
  pub_key: 'sdfdsfsfs',
  order_image_url:
    'https://payment.asoriba.com/assets/asoribalogo-3d4540003815aee230ca676138579ed495cfa975270fe2d7e656292c4508d472.png',
  first_name: 'John',
  last_name: 'Doe',
  email: 'sample@domain.com',
  tokenize: false
}

payment({ AUTH_TOKEN, BASE_URL })
  .checkout(orderDetails)
  .then(data => console.log(data))
  .catch(err => console.log(err))



`Result`

{ id: '5045c6d758a49f',
  url: 'https://paymentsandbox.asoriba.com/payment/v1.0/checkout/new?id=5045c6d758a49f',
  status_code: '100',
  status: 'success' }

Payment Verification

Once payment has been made, you can go ahead and verify the status of the payment.

FIELDDESCRIPTIONREQUIREDDATA TYPE
AUTH_TOKENAuthentication token required to make a succesful call to the asoriba apitruestring
BASE_URLBase url for the http asoriba api. It could be that of the live api or the stage apitruestring
TRANSACTION IDTransaction id provided after successfully making a paymenttruestring

Run

Verification

const AUTH_TOKEN = 'dsdfsdfsdfdfsfsf'

const BASE_URL = 'https://paymentsandbox.asoriba.com'

const TRANSACTION_ID = 'a5b4d7e6fe71e2b4e8cba92ce712ae'

payment({ AUTH_TOKEN, BASE_URL })
  .verifyTransaction(TRANSACTION_ID)
  .then(body => console.log(JSON.parse(body)))
  .catch(err => console.log(err))


`Result`

{ amount: 1,
  metadata: 
   { order_id: 9800,
     product_name: 'STRAWBERRY',
     product_description: 'Description of product/service/donation' },
  currency: 'GHS',
  amount_after_charge: '0.97',
  reference: '556483716525624002',
  processor_transaction_id: '556483716525624002',
  charge: '0.03',
  source: { object: 'card', reference: '1556713769', type: 'Visa' },
  tokenized: false,
  status: 'successful',
  status_code: '100',
  transaction_uuid: 'a5b4d7e6fe71e2b4e8cba92ce712ae',
  payment_date: '2019-04-28T20:35:17Z',
  message: 'Successful transaction.',
  error_fields: [] }

Click here to view Asoriba payment api documentation

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago