paypalxo

0.2.1 • Public • Published

node-paypalxo

Integrate with PayPal's Express Checkout payment flow.

Installation

npm install paypalxo

Usage

See PayPal's Express Checkout integration guide for each APIs required parameters.

var paypalxo = require('node-paypalxo');
 
// Your PayPal API credentials
paypalxo.user = USER;
paypalxo.pwd = PWD;
paypalxo.signature = SIGNATURE;
paypalxo.version = VERSION;
 
 
var params = {
    amt: '1.00',
    returnurl: 'http://example.com/success',
    cancelurl: 'http://example.com/cancel'
};
 
// STEP 1: Get an Express Checkout token from PayPal
paypalxo.ec.setExpressCheckout(params, function (err, data) {
    if (!err) {
        var token = data.TOKEN;
    
        // STEP 2: Send the user to the following URL to checkout on PayPal
        console.log(paypalxo.ec.getLoginURL(token));
    }
});
 
 
// STEP 3: Complete the transaction
paypalxo.ec.doExpressCheckoutPayment(params, function (err, data) {
    if (!err) {
        // This will output the transaction's details
        console.log(data);
    }
});

API

  • paypalxo.useSandbox
  • paypalxo.ec.setExpressCheckout(params, callback)
  • paypalxo.ec.getExpressCheckoutDetails(params, callback)
  • paypalxo.ec.doExpressCheckoutPayment(params, callback)
  • paypalxo.ec.getLoginURL(token)

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i paypalxo

      Weekly Downloads

      5

      Version

      0.2.1

      License

      none

      Last publish

      Collaborators

      • jeffharrell