GithubHelp home page GithubHelp logo

gocardless-pro-node's Introduction

gocardless-pro-node

A Node.js Client for interracting with the Gocardless Pro API

NPM version Build Status

Documentation

See Gocardless Pro API Reference

Installation

Install the package with

npm install gocardless-pro-node --save

or

yarn add gocardless-pro-node

Usage

Create a Client instance and provide the access_token and environment you want to use.

const gocardlessPro = require("gocardless-pro-node");

// Gets Access Token stored in environment variable
const access_token = process.env.ACCESS_TOKEN;
const environment = "sandbox";

const client = new gocardlessPro.Client({
  access_token,
  environment
});

const customers = await client.customers.list({
  params: {
    limit: 30
  }
});

Usage with Typescript

import * as gocardlessPro from "gocardless-pro-node";

// Gets Access Token stored in environment variable
const access_token = process.env.ACCESS_TOKEN;
const environment = "sandbox";

const client = new gocardlessPro.Client({
  access_token,
  environment
});

client.customers
  .list({
    params: {
      limit: 30
    }
  })
  .then(customers => {
    // List of customers
  })
  .catch(error => {
    // Handle error
  });

Events

The Gocardless Client instance emits request and response events

const gocardlessPro = require("gocardless-pro-node");

// Gets Access Token stored in environment variable
const access_token = process.env.ACCESS_TOKEN;
const environment = "sandbox";

const client = new gocardlessPro.Client({
  access_token,
  environment
});

// Add the request event handler function:
client.on("request", request => {
  // Carry out some actions
});

// Add the request event handler function:
client.on("response", response => {
  // Carry out some actions
});

Avaliable resources

  • Bank Details Lookups
  • CreditorBankAccounts
  • Creditors
  • Customer Bank Accounts
  • Customer Notifications
  • Customers
  • Events
  • Mandate Import Entries
  • Mandate Imports
  • Mandate Pdfs
  • Mandates
  • Payments
  • Payout Items
  • Payouts
  • Redirect Flows
  • Refunds
  • Subscriptions

Development

Running tests

$ npm install
$ npm test

or

$ yarn
$ yarn test

To use your Sandbox Access Token to run the tests, you need to set the environment variable SANDBOX_ACCESS_TOKEN

$ export SANDBOX_ACCESS_TOKEN='Your Sandbox Access Token'
$ npm test

gocardless-pro-node's People

Contributors

tolujimoh avatar

Stargazers

 avatar

Watchers

 avatar

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.