1- # SSLCOMMERZ Payment Gateway implementation in NodeJs
1+ # SSLCOMMERZ Payment Gateway itegration in NodeJs
22It is npm package which provides functionalities to implement SSLCommerze Payment Gateway in Node Based Apps.
33
44## Installation
77npm i ssl-commerz-node
88```
99
10- ## Instruction
10+ ## Set the parameters to make a request
1111``` js
1212const SSLCommerz = require (' ssl-commerze-node' );
1313const PaymentSession = SSLCommerz .PaymentSession ;
@@ -27,12 +27,82 @@ payment.setOrderInfo({
2727 total_amount: 1570 , // Number field
2828 currency: ' BDT' , // Must be three character string
2929 tran_id: ' ref12345667' , // Unique Transaction id
30- emi_option: 0 // 1 or 0,
30+ emi_option: 0 , // 1 or 0
3131 multi_card_name: ' internetbank' , // Do not Use! If you do not customize the gateway list,
3232 allowed_bin: ' 371598,371599,376947,376948,376949' , // Do not Use! If you do not control on transaction
3333 emi_max_inst_option: 3 , // Max instalment Option
3434 emi_allow_only: 0 // Value is 1/0, if value is 1 then only EMI transaction is possible
3535});
3636
37+ // Set customer info
38+ payment .setCusInfo ({
39+ name: ' Simanta Paul' ,
40+ email: ' simanta@bohubrihi.com' ,
41+ add1: ' 66/A Midtown' ,
42+ add2: ' Andarkilla' ,
43+ city: ' Chittagong' ,
44+ state: ' Optional' ,
45+ postcode: 4000 ,
46+ country: ' Bangladesh' ,
47+ phone: ' 010000000000' ,
48+ fax: ' Customer_fax_id'
49+ });
50+
51+ // Set shipping info
52+ payment .setShippingInfo ({
53+ method: ' Courier' , // Shipping method of the order. Example: YES or NO or Courier
54+ num_item: 2 ,
55+ name: ' Simanta Paul' ,
56+ add1: ' 66/A Midtown' ,
57+ add2: ' Andarkilla' ,
58+ city: ' Chittagong' ,
59+ state: ' Optional' ,
60+ postcode: 4000 ,
61+ country: ' Bangladesh' ,
62+ });
63+
64+ // Set Product Profile
65+ payment .setProductInfo ({
66+ product_name: ' Computer' ,
67+ product_category: ' Electronics' ,
68+ product_profile: ' general'
69+ });
70+ ```
71+ ** See this for details:** https://developer.sslcommerz.com/doc/v4/#ready-the-parameters
72+
73+ ## After setting the parameters initialize the payment
74+ ``` js
75+ // Initiate Payment and Get session key
76+ payment .paymentInit ()
77+ .then (response => {
78+ console .log (response);
79+ });
3780```
38- See this for details: https://developer.sslcommerz.com/doc/v4/#ready-the-parameters
81+ ** This link containes details about the response parameters:** https://developer.sslcommerz.com/doc/v4/#returned-parameters
82+
83+ ## Response Parameters Examples
84+ ### After Success
85+ ``` js
86+ console .log (response[' status' ]);
87+ ```
88+ > SUCCESS
89+ ``` js
90+ console .log (response[' sessionkey' ]);
91+ ```
92+ > D37CD2C0A0D322991531D217E194F981
93+ ``` js
94+ console .log (response[' GatewayPageURL' ]);
95+ ```
96+ > https://sandbox.sslcommerz.com/EasyCheckOut/testcded37cd2c0a0d322991531d217e194f981
97+
98+ ### After Failure (Wrong Store ID)
99+ ``` js
100+ console .log (response[' status' ]);
101+ ```
102+ > FAILED
103+ ``` js
104+ console .log (response[' failedreason' ]);
105+ ```
106+ > Store Credential Error Or Store is De-active
107+
108+ The ** GatewayPageURL** is the url of the payment page.
0 commit comments