1.0.0 • Published 2 years ago
@lfi-cloudx/mastercard-payment v1.0.0
mastercard-payment
Node module for master card payment APIs
Installation
npm i mastercard-paymentImport 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": "test@gmail.com",
    "mobilePhone": "97158948940"
}
const data = await provider.initiateCheckout(order, customer, interaction)1.0.0
2 years ago