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

Node.js wrapper for the Paypal Name-Value Pair — NVP

  • 0.1.16
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.4K
increased by10.29%
Maintainers
1
Weekly downloads
 
Created
Source

paypal-nvp-api

Node.js wrapper for the Paypal Name-Value Pair — NVP

Usage

import Paypal from '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);

let query = {
  'PAYMENTREQUEST_0_AMT': '$20.00',
  'PAYMENTREQUEST_0_CURRENCYCODE': 'USD',
  'PAYMENTREQUEST_0_PAYMENTACTION': 'Sale'
}

paypal.request('SetExpressCheckout', query).then((result) => {
  console.log(result);
}).catch((err) => {
  console.trace(err);
});

Replace SetExpressCheckout with any available API operation that Paypal supports. Replace username, password and signature with your Paypal app credential Set.

For more info:

  • NVP and SOAP API Reference
  • Creating and managing NVP/SOAP API credentials

API reference

request(String method, Object query)

In which:

  • 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.

formatCurrency(Number amount)

Because Paypal API requires its standard format for currency, you can use this util to quickly convert a number to fit Paypal convention.

paypal.formatCurrency(12); // = '$12.00'
paypal.formatCurrency(12.5); // = '$12.50'
// note that only Number is accepted, so
paypal.formatCurrency('$12.00'); // = '$0.00'

Currently, this method just supports USD.

Test

Module has not been fully tested yet.

FAQs

Package last updated on 03 Nov 2015

Did you know?

Socket

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.

Install

Related posts

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