mastercard-payment
v1.1.1
Published
mastercard payment integration
Downloads
13
Readme
mastercard-payment
Node module for master card payment APIs
Installation
npm i mastercard-payment
Import package
const mastercard = require('mastercard-payment');
Initialize provider instance
const config = {
PROD_MODE: false, # use true for production
USERNAME: "",
PASSWORD: "",
API_VERSION: "",
CURRENCY_LABEL: "",
TEST_GATEWAY_URL: "https://ap-gateway.mastercard.com",
BASEURL: "",
WEBHOOKS_NOTIFICATION_SECRET: "",
WEBHOOKS_NOTIFICATION_FOLDER: "",
SSL_CRT_PATH: "",
SSL_KEY_PATH: ""
}
const provider = mastercard.Init(config)
Create a Session
const data = await provider.createSession()
Update the Session with the Order Amount and Currency
const res = await provider.updateSession(data.session.id, 1)
Initiate Checkout
## Initiate Checkout
order: {
"id": "ADBCed12345",
"currency": "AED",
"description": "Order description",
"amount": "1"
}
const interaction: {
operation: "PURCHASE",
returnUrl: returnUrl,
locale: "AE",
timeout: "1000",
merchant: {
name: "",
logo: "",
},
};
customer: {
"email": "[email protected]",
"mobilePhone": "97158948940"
}
const data = await provider.initiateCheckout(order, customer, interaction)