forked frompsimanta/ssl-commerz-node
- Notifications
You must be signed in to change notification settings - Fork0
Module to implement sslcommerz payment gateway to NodeJs based app
NotificationsYou must be signed in to change notification settings
thetechdevs/ssl-commerz-node
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
It is npm package which provides functionalities to implement SSLCommerz Payment Gateway in Node Based Apps.
Via NPM
npm i ssl-commerz-node
Via YARN
yarn add ssl-commerz-node
- Project Github repo
- Live Demo:
https://sslcommerz.netlify.app
constSSLCommerz=require("ssl-commerz-node");constPaymentSession=SSLCommerz.PaymentSession;require("dotenv").config();// For live payment set first parameter `false` and for sandbox set it `true`constpayment=newPaymentSession(true,process.env.SSLCOMMERZ_STORE_ID,process.env.SSLCOMMERZ_STORE_PASSWORD);// Set the urlspayment.setUrls({success:"yoursite.com/success",// If payment Succeedfail:"yoursite.com/fail",// If payment failedcancel:"yoursite.com/cancel",// If user cancel paymentipn:"yoursite.com/ipn",// SSLCommerz will send http post request in this link});// Set order detailspayment.setOrderInfo({total_amount:1570,// Number fieldcurrency:"BDT",// Must be three character stringtran_id:"ref12345667",// Unique Transaction idemi_option:0,// 1 or 0multi_card_name:"internetbank",// Do not Use! If you do not customize the gateway list,allowed_bin:"371598,371599,376947,376948,376949",// Do not Use! If you do not control on transactionemi_max_inst_option:3,// Max instalment Optionemi_allow_only:0,// Value is 1/0, if value is 1 then only EMI transaction is possible});// Set customer infopayment.setCusInfo({name:"Simanta Paul",email:"simanta@bohubrihi.com",add1:"66/A Midtown",add2:"Andarkilla",city:"Chittagong",state:"Optional",postcode:4000,country:"Bangladesh",phone:"010000000000",fax:"Customer_fax_id",});// Set shipping infopayment.setShippingInfo({method:"Courier",//Shipping method of the order. Example: YES or NO or Couriernum_item:2,name:"Simanta Paul",add1:"66/A Midtown",add2:"Andarkilla",city:"Chittagong",state:"Optional",postcode:4000,country:"Bangladesh",});// Set Product Profilepayment.setProductInfo({product_name:"Computer",product_category:"Electronics",product_profile:"general",});
See this for details:https://developer.sslcommerz.com/doc/v4/#ready-the-parameters
// use SSLCommerz_payment_init function/controller for payment requestexports.SSLCommerz_payment_init=async(req,res)=>{// Initiate Payment and Get session keypayment.paymentInit().then((response)=>{console.log(response);// res.send(response);});}
This link containes details about the response parameters:https://developer.sslcommerz.com/doc/v4/#returned-parameters
console.log(response["status"]);
SUCCESS
console.log(response["sessionkey"]);
D37CD2C0A0D322991531D217E194F981
console.log(response["GatewayPageURL"]);
https://sandbox.sslcommerz.com/EasyCheckOut/testcded37cd2c0a0d322991531d217e194f981
console.log(response["status"]);
FAILED
console.log(response["failedreason"]);
Store Credential Error Or Store is De-active
TheGatewayPageURL is the url of the payment page.
About
Module to implement sslcommerz payment gateway to NodeJs based app
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Languages
- JavaScript100.0%