nova2pay
v1.0.2
Published
Nova2pay SDK for Node.js.
Downloads
38
Maintainers
Readme
nova2pay
Nova2pay SDK for Node.js.
Install
$ npm i nova2pay --saveExample
import Nova2pay from 'nova2pay'
const nova2pay = new Nova2pay({
environment: 'sandbox',
accountId: 'xxx',
md5Key: 'xxx'
})
;(async () => {
const orderId = Date.now()
const returnUrl = 'https://google.com/returnUrl'
const res = await nova2pay.execute({
method: 'POST',
url: '/payment-order/api/transaction/sale',
body: {
merOrderId: `NOVA2PAY_${orderId}`,
merTradeId: `NOVA2PAY_${orderId}`,
shopperIP: '8.8.8.8',
shopperUrl: returnUrl,
version: '2.2',
amount: {
currency: 'USD',
value: '9.99'
},
billingAddress: {
firstName: 'test',
lastName: 'test',
country: 'US',
stateOrProvince: 'AL',
city: 'New York',
street: 'test',
postalCode: '123456',
phone: '13000000000',
email: '[email protected]',
},
deliveryAddress: {
firstName: 'test',
lastName: 'test',
country: 'US',
stateOrProvince: 'AL',
city: 'New York',
street: 'test',
postalCode: '123456',
phone: '13000000000',
email: '[email protected]',
},
card: {
firstName: 'test',
lastName: 'test',
number: '4000000000000002',
expiryMonth: '12',
expiryYear: '2027',
cvc: '212'
},
mddData: {
merchantDefinedData_mddField_19: (new URL(returnUrl)).origin
}
}
})
/*
{
accountId: '10002601',
orderId: 'OD20251203093023007265',
tradeId: 'TD20251203093023007265',
merOrderId: 'NOVA2PAY_1764725421972',
merTradeId: 'NOVA2PAY_1764725421972',
tf_sign: '39178197C71252CBE67F64DC6589EF67',
tradeStatus: 'Approved',
resultCode: '1000',
resultMessage: 'Successful transaction.',
gatewayMessage: '',
merDescribeName: 'n2psystem',
amount: 9.99,
currency: 'USD',
payInformation: '',
payInfoType: ''
}
*/
console.log(res)
})().catch(console.error)