@solidgate/node-sdk
v1.4.0
Published
Solidgate SDK
Downloads
5,918
Readme
SolidGate API
This library provides basic API options of SolidGate payment gateway.
Installation
$ npm install @solidgate/node-sdk
Usage host to host - return Promise
const solidGate = require('@solidgate/node-sdk');
let api = new solidGate.Api("merchant", "private_key", "base_solidgate_url");
let promise = api.charge({
'amount': 10000,
'currency': 'USD',
'customer_email': '[email protected]',
'order_description': 'Premium package',
'order_id': "213",
'platform': 'WEB',
'geo_country': 'ESP',
'form_design_name': 'form-design',
});
promise.then((res) => {
//do smth
})
Usage for form url - return FormInitDTO class
const solidGate = require('@solidgate/node-sdk');
let api = new solidGate.Api("merchant", "private_key");
let merchantData = api.formMerchantData({
'amount': 10000,
'currency': 'USD',
'customer_email': '[email protected]',
'order_description': 'Premium package',
'order_id': "213",
'platform': 'WEB',
'geo_country': 'ESP',
'form_design_name': 'form-design',
});
const dataToFront = merchantData.toObject()
Usage for form initialization - return FormInitDTO class
const solidGate = require('@solidgate/node-sdk');
let api = new solidGate.Api("merchant", "private_key");
let dto = api.formMerchantData({
'amount': 10000,
'currency': 'USD',
'customer_email': '[email protected]',
'order_description': 'Premium package',
'order_id': "213",
'platform': 'WEB',
'geo_country': 'ESP',
});
const dataToFront = dto.toObject()
This values should be applied on frontend in the following way
const form = PaymentFormSdk.init({
merchantData: dataToFront // from backend
})
Usage for form update - return FormUpdateDTO class
const solidGate = require('@solidgate/node-sdk');
let api = new solidGate.Api("merchant", "private_key");
let dto = api.formUpdate({
'amount': 10000,
'currency': 'USD',
'customer_email': '[email protected]',
'order_description': 'Premium package',
'platform': 'WEB',
'geo_country': 'ESP',
});
const dataToFront = dto.toObject()
This values should be applied on frontend in the following way
const form.update(dataToFront)
Usage for form resign initialization - return FormResignDTO class
const solidGate = require('@solidgate/node-sdk');
let api = new solidGate.Api("merchant", "private_key");
let dto = api.formResign({
'amount': 10000,
'currency': 'USD',
'customer_email': '[email protected]',
'order_description': 'Premium package',
'order_id': "213",
'platform': 'WEB',
'geo_country': 'ESP',
'recurring_token': 'some_token',
});
const dataToFront = dto.toObject();
This values should be applied on frontend in the following way
const form = PaymentFormSdk.resign(dataToFront);