tm-service-payment-gate
v1.2.1
Published
Scaffolder to start new service api
Downloads
9
Maintainers
Readme
Documentation
PaymentClientService
Extends TMMicroServiceAPI
Payment client Micro Service API SDK
Parameters
props
...anyurl
string service urltoken
(string | null) user access tocken if available (optional, defaultnull
)
messages
Object with class service messages
constructor
Constructor of instance
Parameters
Examples
(async () => {
const paymentClientService = new CartsService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
})();
Returns object service SDK object
createExtendedPayment
Create extended payment
Parameters
args
object (required) arguments for paymentsargs.cart_id
string (required) cart idargs.project
string (required) project idargs.payment_method_id
string (required) payment method idargs.saved_payment_method_id
string Saved arguments for paymentsargs.email
string (required) user Emailargs.phone
string (required) user phone numberargs.bonuses
number Amount of bonuses to use for payment.args.trackingInfo
object tracking info for payment
Examples
(async () => {
const paymentClientService = new PaymentClientService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const data = await paymentClientService.createExtendedPayment({
cart_id: 111,
project:'monster',
payment_method_id: 'dsfsdhfi9i8304ufds',
email: '[email protected]',
phone: '123456789',
});
})();
Returns object object with new cart properties
createPayment
Create payment
Parameters
args
object (required) arguments for payments
Examples
(async () => {
const paymentClientService = new PaymentClientService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const data = await paymentClientService.createPayment({
cart_id: 111,
project:'monster',
payment_method_id: 'dsfsdhfi9i8304ufds',
email: '[email protected]',
phone: '123456789',
});
})();
Returns object object with new cart properties
retryPayment
Retry payment
Parameters
args
object (required) arguments for payments
Examples
(async () => {
const paymentClientService = new PaymentClientService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const data = await paymentClientService.retryPayment({
order_id: 111,
payment_method_id: 'dsfsdhfi9i8304ufds',
});
})();
Returns object object with new payment url
getSavedPaymentMethodCount
Get saved payment method count
Parameters
email
string (required) client email
Examples
(async () => {
const paymentClientService = new PaymentClientService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const data = await paymentClientService.getSavedPaymentMethodCount('[email protected]');
})();
Returns number payment method count
getCommonPaymentMethods
Get common payment methods
Parameters
args
object (required) list of arguments for payment methods
Examples
(async () => {
const paymentClientService = new PaymentClientService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const data = await paymentClientService.getCommonPaymentMethods({project: 'monster'});
})();
Returns array payment method count
getUserSavedPaymentMethods
Get user saved payment methods
Parameters
args
object (required) list of arguments for payment methods
Examples
(async () => {
const paymentClientService = new PaymentClientService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const data = await paymentClientService.getUserSavedPaymentMethods({project: 'monster', locale: 'en'});
})();
Returns array payment method count