For detailed documentation on the Maple API, please review our API Reference

1

Get an API Token

Create an API token from the Maple web app under Developers > API Token. The generated token will only be visible to you once.

Once created, you cannot retrieve or update the same API token again. Make sure to be save the token in a secure manner

2

Create a Customer

Below is an example to create a customer using the Create Customer API

curl --request request \
       --url https://api.maplebilling.com/api/v1/companies/<COMPANY_ID>/customers \
       --header 'accept: application/json' \
       --header 'authorization: Bearer <API_TOKEN>' \
       --header 'content-type: application/json' \
       --data '
  {
    "email": "[email protected]",
    "name": "Hello Person",
    "org_name": "Hello Co.",
    "phone": "444-4444-4444",
    "title": "Director of Operations",
    "identifier": "external_customer_id"
  }'


Copy the customer’s id from the response.

You can verify that the customer was created using the Web UI or calling the Get Customer or Find Customer API.

3

Create a Product in the UI

You cannot create a product using the API. This is to ensure proper set up and thought around the different components of your pricing plan and strategy.

Go to the Maple web app and navigate to Products > Overview and click on the ‘Add New Product’ button.


Copy the Product Pricing’s id from the UI.

4

Create a Product Pricing in the UI

You cannot create a product pricing using the API. This is to ensure proper set up and thought around the different components of your pricing plan and strategy.

Under the new product, click on ‘Add New Product Pricing’ to create a plan.

5

Create a Subscription

curl --request POST \
     --url https://api.maplebilling.com/api/v1/companies/<COMPANY_ID>/subscriptions \
     --header 'accept: application/json' \
     --header 'authorization: Bearer <API_TOKEN>' \
     --header 'content-type: application/json' \
     --data '
{
    "auto_charges": true,
    "auto_renews": true,
    "currency": "USD",
    "product_pricing_ids": [
        "plan_2ZC39unZNwxsOzvE8K8YRZ6FMBF"
    ],
    "customer_id": "cus_2ZC4MvcO47Iog1PYRZRGHDL90Vu",
    "term": {
        "count": 3,
        "frequency": "MONTH"
    },
    "config_items": [
        {
            "num_licenses": 1
        }
    ]
}
'

The subscription will show up in the Maple web app as follows

6

Review the first invoice

You can verify that the first invoice was generated in the UI or using the Invoice Find API. See examples of both below.

Using web UI

Using Invoice Find API

curl --request POST \
     --url https://api.maplebilling.com/api/v1/companies/company_id/invoices/find \
     --header 'accept: application/json' \
     --header 'authorization: Bearer my_token' \
     --header 'content-type: application/json' \
     --data '
{
  "pagination": {
    "limit": 10
  },
  "query": {
    "customer_id": "cus_2ZC4MvcO47Iog1PYRZRGHDL90Vu"
  },
  "sort_key": "createdAtDesc"
}
'