Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

paypal-nvp-api

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

paypal-nvp-api - npm Package Compare versions

Comparing version 0.1.28 to 0.2.1

test/specs/Paypal/request.js

11

package.json
{
"version": "0.1.28",
"version": "0.2.1",
"name": "paypal-nvp-api",

@@ -16,3 +16,6 @@ "description": "Node.js wrapper for the Paypal Name-Value Pair — NVP ",

"scripts": {
"test": "mocha test"
"test": "./node_modules/.bin/mocha",
"coverage": "./node_modules/.bin/nyc mocha",
"report": "npm run coverage && ./node_modules/.bin/nyc report --reporter=lcov",
"coveralls": "npm run report && cat ./coverage/lcov.info | ./node_modules/.bin/coveralls"
},

@@ -25,4 +28,6 @@ "dependencies": {

"devDependencies": {
"chai": "latest",
"coveralls": "latest",
"mocha": "latest",
"chai": "latest"
"nyc": "latest"
},

@@ -29,0 +34,0 @@ "keywords": [

# paypal-nvp-api
Node.js wrapper for the Paypal Name-Value Pair — NVP
[![NPM](https://badge.fury.io/js/paypal-nvp-api.svg)](https://badge.fury.io/js/paypal-nvp-api) ![Travis](https://travis-ci.org/ndaidong/paypal-nvp-api.svg?branch=master)
[![NPM](https://badge.fury.io/js/paypal-nvp-api.svg)](https://badge.fury.io/js/paypal-nvp-api)
![Travis](https://travis-ci.org/ndaidong/paypal-nvp-api.svg?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/ndaidong/paypal-nvp-api/badge.svg?branch=master)](https://coveralls.io/github/ndaidong/paypal-nvp-api?branch=master)
# Usage
Import module and init an instance with given config:
```

@@ -20,8 +24,39 @@ import Paypal from 'paypal-nvp-api';

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'
}
'PAYMENTREQUEST_0_PAYMENTACTION': 'Sale',
'RETURNURL': 'http://google.com/test/onreturn',
'CANCELURL': 'http://google.com/test/oncancel'
};

@@ -35,10 +70,17 @@ paypal.request('SetExpressCheckout', query).then((result) => {

Replace SetExpressCheckout with any available API operation that Paypal supports.
Replace username, password and signature with your Paypal app credential Set.
In this case, it returns something like this:
For more info:
```
{
TOKEN: 'EC-5Y171147E8077933D',
TIMESTAMP: '2016-03-18T09:58:38Z',
CORRELATIONID: 'e8289e4235624',
ACK: 'Success',
VERSION: '124',
BUILD: '18316154'
}
- [NVP and SOAP API Reference](https://developer.paypal.com/docs/classic/api/)
- [Creating and managing NVP/SOAP API credentials](https://developer.paypal.com/docs/classic/api/apiCredentials/)
```
# API reference

@@ -51,5 +93,9 @@

- *method*: one of API operations Paypal NVP supports, such as SetExpressCheckout, DoCapture, SetCustomerBillingAgreement, etc.
- *query*: a set of parameters you want to send to Paypal API endpoint, relying on which *method* is being used.
For more info:
- [NVP and SOAP API Reference](https://developer.paypal.com/docs/classic/api/)
- [Creating and managing NVP/SOAP API credentials](https://developer.paypal.com/docs/classic/api/apiCredentials/)
### formatCurrency(Number amount)

@@ -72,3 +118,5 @@

Module has not been fully tested yet.
```
npm install
npm test
```

@@ -7,2 +7,2 @@ module.exports = {

signature: 'A0aEilikhBmwfK.NlduDjCbsdgRdA8VDPMDksDhGsHmLQECu80Qtru09'
}
};

@@ -101,3 +101,3 @@ /**

}
]
];

@@ -104,0 +104,0 @@ sample.forEach((item) => {

@@ -10,8 +10,8 @@ 'use strict';

var dirs = ['', 'utils'];
var dirs = [ '', 'utils', 'Paypal' ];
dirs.forEach((dir) => {
let where = './test/specs/' + dir;
if(fs.existsSync(where)){
if (fs.existsSync(where)) {
fs.readdirSync(where).forEach((file) => {
if(path.extname(file) === '.js'){
if (path.extname(file) === '.js') {
require(path.join('.' + where, file));

@@ -18,0 +18,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc