> For the complete documentation index, see [llms.txt](https://docs.received.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.received.ai/subscription-billing/the-subscription-billing-process/auto-charge-payments.md).

# Auto-Charge Payments

## Step 1: Track Usage (for usage-based products)

In the event that a subscription plan includes a **usage-based product**, Received's **usage API** automatically **tracks and calculates usage rates** for each subscriber per billing cycle.

This API is provided by Received, and **embedded into your software**, enabling automatic usage tracking.\
\
Our embeddable API looks like this:

<pre><code><strong>usage_event = {
</strong>  "timestamp": "2024-02-05T08:55:32.160Z",
  "customer_ref": "4096966d-5c1c-4e18-8b47-6a365e3c16ea",
  "customer_name": "ACME",
  "usage_product_ref": "bb50da07-c686-4688-8550-66305e17aab0",
  "usage_product_name": "Units",
  "quantity": 10,
  "additional_report_data": {
    "note": "User-specific note"
  },
  "validations": {
    "currency": "USD",
    "entity_ref": "55899733-32a0-4912-9d2e-a5b0f04dcdb6"
  }
}

event_report_resp = requests.post('https://api.received.ai/api/usage/event', headers=headers, data=json.dumps(usage_event))
</code></pre>

Once this API is embedded, usage is tracked and collected by Received. When it's time to charge customers, Received's **internal API collects the relevant data** and calculates the total due for each specific subscription.

Our API looks like this:

```
// POST/api/usage/event
```

#### Request Body

Example Value

```
{
  "timestamp": "2024-02-05T09:02:27.279Z",
  "customer_ref": "b4fe1e43-321f-479c-aee7-c11d73616ff2",
  "customer_name": "ACME",
  "usage_product_ref": "9db3fbc3-5e77-43c8-828f-bc2b69cbc9f3",
  "usage_product_name": "Units",
  "quantity": 10,
  "additional_report_data": {
    "note": "User-specific note"
  },
  "validations": {
    "currency": "USD",
    "entity_ref": "d78bf43b-e76a-4a70-8f56-d3dfcea0dffe"
  }
}
```

#### Responses

Example Value

```
{
  "event_ref": "d1d3416c-0b33-479e-a42f-dbb74effd290",
  "related_document_ref": "fffb529d-e5ad-4d87-b1e5-fa5085a675b5",
  "related_document_numbers": "US-INV-1234",
  "related_parent_document_ref": "cb88774f-fbdd-42ef-b9eb-822e6c581ee1",
  "related_parent_document_numbers": "US-INV-12345"
}
```

## Step 2: Auto-Charge Customers&#x20;

Received **automatically charges active subscription customers** according to their selected plan and usage rates (where applicable), and sends **payment confirmations.**\
\
Upon payment, Received's system automatically matches auto-charged payments with outstanding balances for **seamless reconciliation** and automatically **recognizes revenue** according to **ASC-606 and IFRS-15** compliance.

<figure><img src="/files/S6XiKD5UYmnXPLhnPij9" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.received.ai/subscription-billing/the-subscription-billing-process/auto-charge-payments.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
