Billing Cycles

Automatic Invoicing Using Billing Cycles


This guide will walk you through enabling automatic billing cycles for you customers. In this example, we will set up a regular billing cycle for a customer and explain how it will automate their invoicing.

Paid's goal is automating your entire Accounts Receivable, especially as it relates to invoicing. As you say in the Getting Started Guide, you can easily generate and issue invoices, but what if you want to automate those steps. Say you know you want your customers invoiced monthly for all outstanding transactions. We should you how to do just that below.


Before You Start

To successfully complete the tutorial, you need to do the following:

  • Sign up for a Paid account and your Test Key will be loaded into the samples below. When you're ready to invoice and receive real money, remember to switch to your Live API key.
  • Edit your account to enable different payment methods. Fill out the appropriate fields to allow ACH, Wire, Credit Card and Check payments.
  • Complete our Getting Started Guide. It will help you through issuing your first invoice.

Select your preferred language for the tutorial:

Step 1: Create a Customer

To start, we'll need to create a new customer. As in the Getting Started Guide, we will use an External ID. For this example, we assume you have a customer with id = 652, but, again, this could be any number or string that you use to uniquely identify your customer.

One important thing to note, is that in this request, if the customer with the supplied External ID does not exist, we will create one for you with the proper attributes. This makes it convenient and easy to create and update customers without having to keep track of whether or not they already exist. It's also important as you are not required to have an existing customer before creating transactions (as demonstrated in the Getting Started Guide).

Create Customer

curl https://api.paidlabs.com/v0/customers/by_external_id?external_id=652 \
  -u {YOUR API KEY}: \
  -d "name=Awesome Customer" \
  -d "email=hello@paidlabs.com" \
  -d "address_phone=4155069330" \
  -d "address_line1=2261 Market Street" \
  -d "address_line2=#567" \
  -d "address_city=San Francisco" \
  -d "address_state=CA" \
  -d "address_zip=94114" \
  -d "billing_cycle=monthly"

Create Customer Response

{
  "id": "cus_DLjf9aDKE8ekdncz",
  "object": "customer",
  "name": "Awesome Customer",
  "email": "hello@paidlabs.com",
  "external_id": "652",
  "address_line1": "2261 Market Street",
  "address_line2": "#567",
  "address_city": "San Francisco",
  "address_state": "CA",
  "address_zip": "94114",
  "phone": "4155069330",
  "allow_ach": true,
  "allow_check": true,
  "allow_credit_card": true,
  "allow_wire": true,
  "terms": 30,
  "billing_type": "invoice",
  "billing_cycle": "monthly",
  "stripe_customer_id": null,
  ...
}

With billing_cycle = 'monthly', Paid will automatically generate invoices for this customer on the 1st of every month. Now all you need to do is create transactions, being sure to use the same External ID (or Paid customer ID), and Paid will include all those transactions on the following month's invoice.

Paid offers other billing cycles, such as manual and weekly. You can customize many things about how the customer is invoiced. For further detail, check out our Full API Reference.


Congratulations! You've set up a customer on an regular billing cycle. Next up are Subscriptions, a way to integrate your plans into Paid.