Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
cross-switch
Advanced tools
Readme
Nodejs API wrapper for Cross-Switch Ghana.
npm install cross-switch
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);
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.
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);
});
FAQs
Cross-Switch Ghana API wrapper
We found that cross-switch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.