Recipe

Introduction

In this section you will find step-by-step recipes for integrating the Collections API into your product. Below you will find recipes to:

  • Create a Plan
  • Debit a Customer

Collections Recipe

StepCorresponding Code (JavaScript)
Create a Plan — Guidance regarding this step can be found here.
Add a Customer to a Plan — Compile the request body by gathering the appropriate planId along with an array of customer objects, including an email or slug for each customer.
const options = {
  method: 'POST',
  headers: {
    Accept: 'application/json',
    'Content-Type': 'application/json',
    Authorization: 'Bearer {user}'
  }
};

fetch('https://prod.api.getborderless.com/addCustomersToRecurringPaymentPlan', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
Debit a Customer — Compile the request body by gathering the appropriate paymentAmount, paymentDescription, planId, and customerHandle.
const options = {
  method: 'POST',
  headers: {
    Accept: 'application/json',
    'Content-Type': 'application/json',
    Authorization: 'Bearer {user}'
  }
};

fetch('https://prod.api.getborderless.com/customerOnDemandDebit', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));