Last active
October 15, 2020 11:16
-
-
Save musen/2aaa0c312b2f4aea44ec374a6e543914 to your computer and use it in GitHub Desktop.
Code snippet for MedaPay node library.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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