Skip to content

mrbatista/loopback-component-paypal

Folders and files

NameName
Last commit message
Last commit date
Oct 2, 2017
Oct 2, 2017
Oct 2, 2017
Mar 29, 2016
Oct 2, 2017
Mar 29, 2016
Oct 2, 2017
Oct 2, 2017
Oct 2, 2017
Mar 29, 2016
Oct 2, 2017
Oct 2, 2017
Oct 2, 2017

Repository files navigation

loopback-component-paypal

NPM version Build Status Dependency Status

Installation

$ npm install --save loopback-component-paypal

Usage

Define new datasourc configuration for your PayPal account (file datasources.json)

{
  "paypal": {
    "clientID": "CLIENT_ID",
    "clientSecret": "CLIENT_SECRET",
    "mode": "sandbox",
    "payment": {
      "intent": "sale",
      "redirect_urls": {
        "return_url": "return_url",
        "cancel_url": "cancel_url"
      },
      "payer": {
        "payment_method": "paypal"
      }
    }
  }
}

Define new model in file model-config.json with datasource paypal

{
    "PayPal": {
      "dataSource": "paypal",
      "public": false
    }
}

use model PayPal in your application:

PayPal.payment.create(create_payment_json, function (error, payment) {
    if (error) {
        console.log(error.response);
        throw error;
    } else {
        console.log("Create Payment Response");
        console.log(payment);
    }
});

License

MIT © Matteo Padovano

About

Loopback PayPal Component

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published