Socket
Socket
Sign inDemoInstall

cross-switch

Package Overview
Dependencies
50
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cross-switch

Cross-Switch Ghana API wrapper


Version published
Maintainers
1
Created

Readme

Source

Cross-Switch Ghana

Issues Issues

Star Star

License Issues

Nodejs API wrapper for Cross-Switch Ghana.

https://nodei.co/npm/YOUR-MODULE-NAME.png?downloads=true&downloadRank=true&stars=true

Installation

npm install cross-switch

Usaged


var live = false;

if (process.env.NODE_ENV === 'production') {
	live = true;
}
// Require the library
var cross_switch = require('cross-switch')(process.env.APP_ID, process.env.APP_KEY, live);


Making calls to the resources

The resource methods accepts are promisified, but can receive optional callback as the last argument.

// cross_switch.{resource}
cross_switch.payment.createPayment({})
	.then((body)=> {
  		console.log(body);
	})
	.catch((error)=> {
		console.log(error);
	});

For all resource methods, the JSON body can be passed as the argument.

Resources

  • payment
    • createPayment
    • Collection
    • Cashout
    • getBalance
    • verifyPayment
    • Ota
  • sms
    • Coming soon

Method to Initiation Sending or Receiving from mobile Money.

	cross_switch.payment.createPayment({
		type: 'Receive || Send',
		name: 'Harmony Alabi',
		mobile: '+233540000000',
		mobile_network: 'MTN',
		email: 'harmony@cross-switch.com',
		currency: 'GHS',
		amount: 0.1,
		order_id: `${Math.ceil(Math.random() * 10e8)}`,
		order_desc: 'Testing',
		account: '',
		signature: '',
		callback: ''
	}).then((body)=> {
		console.log(body);
	}).catch((error)=> {
		console.log(error);
	});

Method to Initiation Only Receiving from mobile Money.

	cross_switch.payment.Collection({
		name: 'Harmony Alabi',
		mobile: '+233546467407',
		mobile_network: 'MTN',
		email: 'harmony@icloud.com',
		currency: 'GHS',
		amount: 0.1,
		order_id: `${Math.ceil(Math.random() * 10e8)}`,
		order_desc: 'Testing',
		account: '',
		signature: '',
		callback: ''
	}).then((body)=> {
		console.log(body);
	}).catch((error)=> {
		console.log(error);
	});;

Method to Initiation Only Receiving from mobile Money.

	cross_switch.payment.Cashout({
		name: 'Harmony Alabi',
		mobile: '+233546467407',
		mobile_network: 'MTN',
		email: 'harmony@icloud.com',
		currency: 'GHS',
		amount: 0.1,
		order_id: `${Math.ceil(Math.random() * 10e8)}`,
		order_desc: 'Testing',
	}).then((body)=> {
		console.log(body);
	}).catch((error)=> {
		console.log(error);
	});

Method to Get Cashout Balance.

	cross_switch.payment.getBalance({})
	.then((body)=> {
		console.log(body);
	}).catch((error)=> {
		console.log(error);
	});

Method to Verify Transaction status.

	cross_switch.payment.verifyPayment({
		order_id: `${data.transaction_no}`,
	}).then((body)=> {
		console.log(body);
	}).catch((error)=> {
		console.log(error);
	});

Todo

  • Add MOMO Number Verification
  • Add MOMO Direct Debit
  • Sms

Keywords

FAQs

Last updated on 19 Mar 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc