Skip to content

Instantly share code, notes, and snippets.

@musen
Last active October 15, 2020 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save musen/2aaa0c312b2f4aea44ec374a6e543914 to your computer and use it in GitHub Desktop.
Save musen/2aaa0c312b2f4aea44ec374a6e543914 to your computer and use it in GitHub Desktop.
Code snippet for MedaPay node library.
const IS_SANDBOX = true;
//Require the MedaPay module and initialize with provided token
const MedaPay = require('medapay').init({
bearerToken: 'eyJ......'
}, IS_SANDBOX);
...
//Create bill
MedaPay.create(SAMPLE_BILL)
.then(createBillResponse => console.log(createBillResponse.billReferenceNumber))
.catch(error => console.error(error));
//Fetch bill using reference number
MedaPay.bill(billReferenceNumber)
.then(bill => console.log(bill.status))
.catch(error => console.error(error));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment