Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
paypal-nvp-api
Advanced tools
Node.js wrapper for the Paypal Name-Value Pair — NVP
Import module and init an instance with given config:
var Paypal = require('paypal-nvp-api');
let config = {
mode: 'sandbox', // or 'live'
track: 'https://www.sandbox.paypal.com', // or 'https://www.paypal.com' if live
username: 'someone.itravellocal.com',
password: 'DYKNJZZE42ASN699',
signature: 'A0aEilikhBmwfK.NlduDjCbsdgXdA8VDPMDksDhGsHmLQECu80Qtru09'
}
let paypal = Paypal(config);
Build query and send to Paypal server:
paypal.request('GetBalance', {}).then((result) => {
console.log(result);
}).catch((err) => {
console.trace(err);
});
The 'result' looks like this:
{
L_AMT0: '71084.27',
L_CURRENCYCODE0: 'USD',
TIMESTAMP: '2016-03-18T09:48:16Z',
CORRELATIONID: 'e3de6137ce65c',
ACK: 'Success',
VERSION: '124',
BUILD: '18316154'
}
Another example with "SetExpressCheckout" operation:
let query = {
'PAYMENTREQUEST_0_AMT': '20.00',
'PAYMENTREQUEST_0_CURRENCYCODE': 'USD',
'PAYMENTREQUEST_0_PAYMENTACTION': 'Sale',
'RETURNURL': 'http://google.com/test/onreturn',
'CANCELURL': 'http://google.com/test/oncancel'
};
paypal.request('SetExpressCheckout', query).then((result) => {
console.log(result);
}).catch((err) => {
console.trace(err);
});
In this case, it returns something like this:
{
TOKEN: 'EC-5Y171147E8077933D',
TIMESTAMP: '2016-03-18T09:58:38Z',
CORRELATIONID: 'e8289e4235624',
ACK: 'Success',
VERSION: '124',
BUILD: '18316154'
}
In which:
For more info:
You can use this util to quickly convert a number to standard currency format that fits Paypal convention.
Return: a string in the format of X,XXX,XX.XX (used in United States, Canada).
paypal.formatCurrency(123456); // = '123,456.00'
paypal.formatCurrency(12345); // = '12,345.00'
paypal.formatCurrency(1234); // = '1,234.00'
paypal.formatCurrency(12); // = '12.00'
paypal.formatCurrency(12.5); // = '12.50'
paypal.formatCurrency('12.00'); // = '12.00'
git clone https://github.com/ndaidong/paypal-nvp-api.git
cd paypal-nvp-api
npm install
npm test
The MIT License (MIT)
FAQs
Node.js wrapper for the Paypal Name-Value Pair — NVP
The npm package paypal-nvp-api receives a total of 4,315 weekly downloads. As such, paypal-nvp-api popularity was classified as popular.
We found that paypal-nvp-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.