0.2.3 • Published 8 years ago

paypalec.js v0.2.3

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

paypalec.js Build Status

(Yet Another) Library for Paypal Express Checkout for Node.js

Installation

The easiest installation is through NPM:

npm install paypalec.js

Or clone the repo https://github.com/auridevil/paypalec.js and include the ./PaypalService script.

API

Initialize:

var PaypalService = require('paypalec.js');
var paypalEC = new PaypalService('USER','PWD','SIGNATURE',isProduction);

Ask Authorization:

paypalEC.askAuthorization(
    <AMOUNT>,
    <CURRENCYCODE>,
    <cancelURL>,
    <acceptURL,
    {<extraOptions},
    function onOk(err,res){
        if(!err)
            console.log(paypalEC.generatePaymentUrlFromRaw(res));
    });
    

Get Details:

paypalEC.askExpressCheckoutDetails(<TOKEN>,{},
    function onOk(err,res) {
        if(!err)
            console.log(JSON.stringify(paypalEC.objectify(res)));
    });
    

Do ExpressCheckout Payment:

paypalEC.doExpressCheckoutPayment(
    <TOKEN>,
    <PAYERID>,
    <AMOUNT>,
    <CURRENCYCODE>,
    {<extraOptions},
    function onOk(err,res) {
        if(!err)
            console.log(JSON.stringify(paypalEC.objectify(res)));
    });
    

Do Capture:

paypalEC.doCapture(
    <TRANSACTIONID>,
    <AMOUNT>,
    <CURRENCYCODE>,
    {<extraOptions},
    function onOk(err,res) {
        if(!err)
            console.log(JSON.stringify(paypalEC.objectify(res)));
    });

Do Void:

paypalEC.doVoid(
    <TRANSACTIONID>,
    {<extraOptions},
    function onOk(err,res) {
        if(!err)
            console.log(JSON.stringify(paypalEC.objectify(res)));
    });

Docs

The library is based on the following paypal guide for ExpressCheckout Authorize and Capture: https://developer.paypal.com/docs/classic/express-checkout/ht_ec-singleAuthPayment-curl-etc/

In the /docs folder you can find a jsDoc of the library with all others methods documented.

Contributions

If you find bugs or want to change functionality, feel free to fork and pull request.

Notes

The library use the es6 language, please make sure your node version supports it (we currently used 4.3.1).

Cheers from digitalx.

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.9

8 years ago

0.1.8

8 years ago

0.1.7

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago