enthusiast-solutions-sdk-js
v1.0.7
Published
Enthusiast Solutions JavaScript SDK
Readme
Enthusiast Solutions Javascript package

What is it?
It is package that will help you with generating payment URL according to Documentation.
How to use?
Get payment page URL
- Install the package (with your package manager):
npm install enthusiast-solutions-sdk-js
yarn add enthusiast-solutions-sdk-js- Require somewhere in your code, set parameters and get the URL:
const { Payment } = require('enthusiast-solutions-sdk-js');
// create ECP object with your account ID and secret salt
const e = new Payment('112', 'my_secret', {}, 'https://paymentpage.enthusiast.com');
// set payment details
e.paymentAmount = 1000;
e.paymentId = 'FFCD12-30';
e.paymentCurrency = 'USD';
// set another parameters, like success or fail callback URL, customer details, etc.
// get payment URL
const url = e.getUrl();Now your can render payment url somewhere on your checkout page.
Receive callback from Enthusiast Solutions
Example with Express:
const { Callback } = require('enthusiast-solutions-sdk-js');
app.post('/payment/callback', function(req, res) {
const callback = new Callback('secret', req.body);
if (callback.isPaymentSuccess()) {
const paymentId = callback.getPaymentId();
// here is your code for success payment
}
});Note that Callback constructor throws Error if signature isn't valid.
