Paypal Node API
A wrapper around paypal's REST API, featuring events, promise support and auto auth.
Only supports subscriptions and orders for now, others will be added per request.
THIS IS NOT AN OFFICIAL API
Installation
NPM:
npm i kik-paypal-api
Usage
Requests
Getting Started
You can use the API by creating an instance of PaypalClient
.
const PaypalClient = ; paypal = env: "sandbox" clientId: "id" secret: "secret" config: {};
env
: one of either "sandbox" or "live"
clientId
: your app's client id
secret
: your app's secret
config
: a config object
Sharing a paypal instance:
const PaypalClient = ; const clientId = "yourApp'sId";const secret = "yourApp'sSecret"; const paypal = "sandbox" clientId secret; //event handlers go herepaypal; moduleexports = paypal;
The Basics
The Extras Object
All required parameters are supplied directly to the functions,
non required parameters can be supplied via the extras
parameter, this
object is merged into the request's payload
The Error Object
Requests
Orders
Create
await paypalorders;
intent
: either "CAPTURE" or "AUTHORIZE"
purchaseUnits
: an array of purchase_unit_request objects
Update
await paypalorders;
orderId
: the target order's id
patchRequest
: an array of patch objects
Details
await paypalorders;
orderId
: the target order's id
Authorize
await paypalorders;
orderId
: the target order's id
Capture
await paypalorders;
orderId
: the target order's id
Subscriptions
Create
await paypalsubscriptions;
planId
: the plan associated with this subscription
Details
await paypalsubscriptions;
subscriptionId
: the subscription id to retrieve
returns the subscription object
Webhooks
Verify
await paypalwebhooks
returns true if verified, false if not