enouvo-payments
v1.0.30
Published
A module to support for some payment methods
Downloads
9
Readme
const paypalConfig = new PaypalConfig(
{
ClientID: '<Your Paypal Client ID>',
ClientSecret: '<Your Paypal Client secret>',
ReturnUrl: '<Returned URK>',
CancelUrl: '<Cancel URL>'
},
false
)
const paymentConfig = new PaymentConfig({ paypal: paypalConfig, momo: {}, airpay: {} })
const createPayment = async paymentType => {
const paymentService = getPaymentService(paymentType, paymentConfig)
const paymentRequest = new CreatePaymentRequest({
transactionAmount: 50,
currency: 'USD',
description: 'testing tranfer transaction'
})
const createPaymentResult = await paymentService.createPayment(paymentRequest)
console.log(createPayment)
return createPaymentResult
}
const executePayment = async (paymentType, orderID) => {
const paymentService = getPaymentService(paymentType, paymentConfig)
const executePaymentResult = await paymentService.executePayment(orderID)
console.log(executePayment)
return executePaymentResult
}