Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cross-switch

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cross-switch

Cross-Switch Ghana API wrapper

  • 1.0.0
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 19 Mar 2022

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc