Lightweight API wrapper for making requests to GoCardless.
See the GoCardless docs for a list of valid resources.
Installation
npm install --save gocardless-api
Usage
Constructor
new GoCardless()
=> GoCardlessClient
Creates a new client instance using your GoCardless access token
const gocardless = YOUR_ACCESS_TOKEN
Client Methods
.request(options)
=> Promise(GoCardlessResource)
Makes an API request, then returns the resulting resource.
const GoCardless = const gocardless = YOUR_ACCESS_TOKENgocardless
The request will automatically add the following headers:
Authorization: Bearer <YOUR_ACCESS_TOKEN>
GoCardless-Version: 2015-07-06
You can override these headers using options.headers
(see below)
request options
Object:
method
(String): HTTP request method. One ofGET
,PUT
,PATCH
orDELETE
resource
(String): Path to the requested resource (e.g.customers
,mandates/123
)data
(Object): Data to accompanyPUT
orPATCH
requestsquery
(Object): Query string askey=>value
pairs (e.g.{ limit: 10, after: ID789 }
becomes?limit=10&after=ID789
)options
(Object): Additional request options. Passed directly toneedle
.