npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

asoriba-payment

v1.1.2

Published

Node wrapper for the asoriba payment api

Downloads

21

Readme

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

| FIELD | DESCRIPTION | REQUIRED | DATA TYPE | | -------- | -------------------- | --------- | ------------ | | AUTH_TOKEN | Authentication token required to make a succesful call to the asoriba api | true | string | | BASE_URL | Base url for the http asoriba api. It could be that of the live api or the stage api | true | string | | PAYMENT DETAILS | Contains the details of the payment or order | true | object |

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: '[email protected]',
  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.

| FIELD | DESCRIPTION | REQUIRED | DATA TYPE | | -------- | -------------------- | --------- | ------------ | | AUTH_TOKEN | Authentication token required to make a succesful call to the asoriba api | true | string | | BASE_URL | Base url for the http asoriba api. It could be that of the live api or the stage api | true | string | | TRANSACTION ID | Transaction id provided after successfully making a payment | true | string |

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