@lfi-cloudx/mastercard-payment

1.0.0 • Public • Published

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": "test@gmail.com",
    "mobilePhone": "97158948940"
}
const data = await provider.initiateCheckout(order, customer, interaction)

Package Sidebar

Install

npm i @lfi-cloudx/mastercard-payment

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

13.3 kB

Total Files

5

Last publish

Collaborators

  • fakhergh
  • frank.fontcha
  • aneep.vai