Coder Social home page Coder Social logo

paypal-pay's Introduction

Minimalist 'send money to email' - using the Paypal API

The module is a simple wrapper on top of the paypal-adaptive-sdk-nodejs module. By default sender pays all fees.

Installation

Installing the module

npm install paypal-pay

How to use

var pay = require('paypal-pay')({
{
      //required parameters
      'userId': '',
      'password': '',
      'signature' : '',

      //make sure that senderEmail and above credentials are from the same paypal account
      //otherwise paypal won't compete payment automatically
      'senderEmail' : '',

      //optional parameters and their defaults
      'sandbox': true,
      'feesPayer': 'SENDER',
      'currencyCode': 'USD',
});

pay('[email protected]', 18.00, "This is an example memo', function(err, response){
    if(err){
        //response.error -- will contains errors if something went wrong
        //see response examples below for more details

        return;
    }
});

Useful information:

Paypal adaptive payments api documentation.

How to get started?

  1. Check your account status. Login to PayPal. Go to your PayPal Profile and click My settings. Confirm that your Account type is either Premier or Business, or upgrade your account.
  2. Check your API settings. Click My selling tools. Expand Selling online if needed and check API access. Click Update and Add or edit API permission or View API signature.
  3. Test your integration using the PayPal Sandbox, as described in Testing Classic API Calls. All Adaptive API calls in the Sandbox must have the following standard value as the App ID: APP-80W284485P519543T
  4. To go live with your application, follow the submission steps outlined in Going Live with Your Application. When you submit your application to PayPal for review, the application is quickly scanned for the requests to PayPal operations. If no "advanced" operations are found, PayPal issues an App ID for the production servers at the time you submit the application. If your application uses "advanced" PayPal operations, or if your application implements a complex business model, you can expect the review to take approximately 10 โ€“ 15 days.

More information can be found in Paypal adaptive payments documentation

Response examples:

Success:

{
   "responseEnvelope":{
      "timestamp":"2014-03-25T00:03:02.486-07:00",
      "ack":"Success",
      "correlationId":"30eb8c99e2200",
      "build":"10175386"
   },
   "payKey":"AP-5RW588649M220974T",
   "paymentExecStatus":"COMPLETED",
   "paymentInfoList":{
      "paymentInfo":[
         {
            "transactionId":"4DB51146SF913544T",
            "transactionStatus":"COMPLETED",
            "receiver":{
               "amount":"10.00",
               "email":"[email protected]",
               "primary":"false",
               "accountId":"MY2AP9Y85VAD6"
            },
            "pendingRefund":"false",
            "senderTransactionId":"9TA40881PA968474G",
            "senderTransactionStatus":"COMPLETED"
         }
      ]
   },
   "sender":{
      "accountId":"S46RUQD499YWJ"
   },
   "httpStatusCode":200
}

Error:

{
   "responseEnvelope":{
      "timestamp":"2014-03-24T23:49:22.419-07:00",
      "ack":"Failure",
      "correlationId":"6db128a52e68c",
      "build":"10175386"
   },
   "error":[
      {
         "errorId":"589039",
         "domain":"PLATFORM",
         "subdomain":"Application",
         "severity":"Error",
         "category":"Application",
         "message":"The email address [email protected] is invalid. It may not be registered in PayPal's system yet",
         "parameter":[
            "[email protected]",
            "Sender Account not found"
         ]
      }
   ],
   "httpStatusCode":200
}

Contribution

We are happy to accept pull requests. Before issue pull request please make sure that tests are passing and code formatting is okay via grunt command.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.