Coder Social home page Coder Social logo

txnpay-js's Introduction

TraxionPay JavaScript SDK

Table of Contents

Installation

npm install txnpay

Usage

Initialize

After installing, initialize by importing the package and using the public and secret keys.

// ES5
const { TraxionPay } = require('txnpay');
// ES6
import { TraxionPay } from 'txnpay';

const traxionpay = new TraxionPay(apiKey, secretKey);

Cash in

// Sample arguments are the bare minimum for cash_in
const response = await traxionpay.cashIn({
  merchant_id: 6328,
  merchant_ref_no: "ABC123DEF456",
  merchant_additional_data: { "payment_code": "ABC123DEF456" }, 
  description: "My test payment",
  amount: 1500.0,
  status_notification_url: apiurl,
  success_page_url: devUrl,
  failure_page_url: devUrl,
  cancel_page_url: devUrl,
  pending_page_url: devUrl,
  billing_details: {
    billing_email: '[email protected]'
  }
});

Cash out

const { code } = await traxionpay.fetchOTP();
const response = await traxionpay.cashOut({
  OTP: code,
  amount: 100,
  bank_account: 433
});

Link a bank account

const response = await traxionpay.linkBankAccount({
  bank: '6311',
  bank_type: 'savings',
  account_name: 'John Doe',
  account_number: '123456789'
});

Fetch Cash Out OTP

const { code } = await traxionpay.fetchOTP();

Fetch bank accounts

const bankAccounts = await traxionpay.fetchBankAccounts();

Fetch banks

const banks = await traxionpay.fetchBanks();

txnpay-js's People

Contributors

johnvalle avatar jvalle-traxion avatar

Watchers

 avatar

Forkers

johnvalle

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.