cardpay-sdk

0.0.8 • Public • Published

CardPay

Installation

$ npm install cardpay-sdk --save

Documentation

configure(configObj);

Configuration global parameters.

Arguments

  • configObj
    • production - true for production and false for sandbox (Default false)
    • g_type - grant_type (Should be password as stated in OAuth specification)
    • t_code - terminal_code (Unique terminal code used by the Cardpay payment system)
    • pwd - password (Terminal password)
    • c_secret - callback secret (Callback secret is also generated by Cardpay and received by Merchant with terminal code)

Usage

const cardpay = require('cardpay-sdk')
let configObj = {
   production: false,
   g_type: '',
   t_code: '',
   pwd: '',
   c_secret: ''
}
cardpay.configure(configObj);

pay(paymentParams, [configObj]);

Create redirect url

Arguments

  • paymentParams

    • m_id - Merchant Order ID Required
    • m_desc - Merchant Order Description Required or global config
    • p_method - Payment Method Required or global config
    • pd_currency - Payment Currency Optional or global config
    • pd_amount - Payment Amount Required
    • c_id - Unique Customer ID Required
    • c_email - Customer Email Address Required
    • c_locale - Customer Language Optional or global config
    • ru_success - Return Success URL Required or global config
    • ru_decline - Return Decline URL Required or global config
    • ru_cancel - Return Cancel URL Required or global config
    • ru_inprocess - Return In Process URL Required or global config
  • configObj - Optional - use global config first

Usage

let paymentData = {
    m_id: "00b46e01-3994-4ac2-939e-2d5052a65961",
    m_desc: 'sdasda',
    p_method: 'BANKCARD',
    pd_currency: 'EUR',
    pd_amount: "5.01",
    c_email: "x@x.io",
    c_id: "5sad3e123",
    c_locale: "en",
    ru_success: "http://70e47cb2.ngrok.io/success",
    ru_decline: "http://70e47cb2.ngrok.io/decline",
    ru_cancel: "http://70e47cb2.ngrok.io/cancel",
    ru_inprocess: "http://70e47cb2.ngrok.io/process",
};

let options = {
    test: true
}

// using async/await
try{
let payment = await cardpay.pay(paymentData, options);
}
catch(e){
// catch errors
}

// using promises
cardpay.pay(paymentData)
.then(success => {
// redirect URL
};
.error(err => {
}}

verify(options);

Verify callback signature middleware

Arguments

  • options - Optional - ["domain"]

Usage

app.post('/callback' , cardpay.verify(['ngrok.io']), async function(req, res, next) {
// your code here
}

Readme

Keywords

Package Sidebar

Install

npm i cardpay-sdk

Weekly Downloads

0

Version

0.0.8

License

MIT

Unpacked Size

15.7 kB

Total Files

9

Last publish

Collaborators

  • karankohli13