You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

cross-switch-gh

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cross-switch-gh

Cross-Switch Ghana API wrapper

1.0.1
latest
Source
npmnpm
Version published
Weekly downloads
8
100%
Maintainers
1
Weekly downloads
 
Created
Source

Cross-Switch Ghana

Issues Star Issues

Nodejs API wrapper for Cross-Switch Ghana.

NPM

Installation

npm install cross-switch-gh

Usaged


var live = false;

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

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
  • customer
    • createCustomer
    • getCustomer
    • getCustomerBill
  • sms
    • sendSms
    • sendOtp
    • verifyOtp
  • Bill
    • createBill
    • getBill
    • payBill
  • Page (Payment Link)
    • createPage - Coming soon
    • getPage - Coming soon
    • Payment - Coming soon
  • Invoice (Payment Link)
    • createInvoice - Coming soon
    • getInvoice - Coming soon
    • PayInvoice - Coming soon

Method to Initiation Sending or Receiving from mobile Money.

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

Method to Initiation Only Receiving from mobile Money.

cross_switch.payment.Collection({
	name: 'Firstname Lastname',
	mobile: '+233540000000',
	mobile_network: 'MTN || AIRTEL || TIGO || VODAFONE',
	email: 'harmony@icloud.com',
	currency: 'GHS',
	amount: 0.1,
	order_id: `${Math.ceil(Math.random() * 10e8)}`,
	order_desc: 'Testing',
	account: '',
	customerid: '',
	callback: '',
}).then((body)=> {
	console.log(body);
}).catch((error)=> {
	console.log(error);
});;

Method to Initiation Only Sending to mobile Money.

cross_switch.payment.Cashout({
	name: 'Firstname Lastname',
	mobile: '+233540000000',
	mobile_network: 'MTN || AIRTEL || TIGO || VODAFONE',
	email: 'harmony@icloud.com',
	currency: 'GHS',
	amount: 1,
	order_id: `${Math.ceil(Math.random() * 10e8)}`,
	order_desc: 'Testing',
	customerid: '',
	callback: '',
}).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

Keywords

API

FAQs

Package last updated on 16 Aug 2023

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