Last active
December 2, 2020 19:46
-
-
Save rkbi/1f60ff8ec2a70f6d4b6ac296c0c18f83 to your computer and use it in GitHub Desktop.
SSLCommerz Example for Node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Make sure to install open with "npm install open" first | |
const SSLCzData = require("./SSLCzData"); | |
const PublicSslCommerzPayment = require("./PublicSslCommerzPayment"); | |
const open = require('open'); | |
class SSLCommerzPayment extends PublicSslCommerzPayment { | |
constructor(data, live) { | |
const newdata = new SSLCzData(data); | |
super(newdata.getPaymentArray(), live); | |
} | |
} | |
module.exports = SSLCommerzPayment; | |
let test = new SSLCommerzPayment({ | |
store_id: 'testbox', | |
store_passwd: 'qwerty', | |
total_amount: 100, | |
currency: 'EUR', | |
tran_id: 'REF123', | |
success_url: 'http://yoursite.com/success.php', | |
fail_url: 'http://yoursite.com/fail.php', | |
cancel_url: 'http://yoursite.com/cancel.php', | |
shipping_method: 'Courier', | |
product_name: 'Computer.', | |
product_category: 'Electronic', | |
product_profile: 'general', | |
cus_name: 'Customer Name', | |
cus_email: 'cust@yahoo.com', | |
cus_add1: 'Dhaka', | |
cus_add2: 'Dhaka', | |
cus_city: 'Dhaka', | |
cus_state: 'Dhaka', | |
cus_postcode: '1000', | |
cus_country: 'Bangladesh', | |
cus_phone: '01711111111', | |
cus_fax: '01711111111', | |
ship_name: 'Customer Name', | |
ship_add1: 'Dhaka', | |
ship_add2: 'Dhaka', | |
ship_city: 'Dhaka', | |
ship_state: 'Dhaka', | |
ship_postcode: 1000, | |
ship_country: 'Bangladesh', | |
multi_card_name: 'mastercard', | |
value_a: 'ref001_A', | |
value_b: 'ref002_B', | |
value_c: 'ref003_C', | |
value_d: 'ref004_D' | |
}, true); | |
test.then(function(val) { | |
// console.log(val); | |
let GatewayPageURL = val.GatewayPageURL; | |
console.log(GatewayPageURL); | |
open(GatewayPageURL); | |
}).catch(function(err) { | |
console.err(err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment