> For the complete documentation index, see [llms.txt](https://docs.biti.so/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.biti.so/auto-pay.md).

# auto pay

A mandate is an approval from the customer. The customer approves a limit per period. You charge within it.

## Steps

1. Call [`create-mandate`](file:///sirihduSQLZLwiPgqdx7/08c9d12f-863a-4aa7-9df8-1450285914df/api-reference/auto-pay.md#post-partnerv1create-mandate) with `max_amount`, `currency` and `period`. The mandate is `pending` for 7 days.
2. Ask the customer to approve. In the mini browser, call `biti.requestApproval({ mandate_id })`. In a normal browser, redirect to `/pay/mandate/<id>`.
3. You get `mandate.active` when the customer approves.
4. Call [`charge-mandate`](file:///sirihduSQLZLwiPgqdx7/08c9d12f-863a-4aa7-9df8-1450285914df/api-reference/auto-pay.md#post-partnerv1charge-mandate) each time you need to take money. You get `mandate.charged`.
5. Read what is left with [`get-mandate-status`](file:///sirihduSQLZLwiPgqdx7/08c9d12f-863a-4aa7-9df8-1450285914df/api-reference/auto-pay.md#post-partnerv1get-mandate-status).

A period is a calendar month (from the 1st) or a week (from Monday).

```bash
curl -X POST "https://api.biti.so/partner/v1/create-mandate" \
  -H "Content-Type: application/json" \
  -d '{"client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET",
       "max_amount": 200, "currency": "USD", "period": "month",
       "reference": "AUTOPAY-C1009", "description": "Diyaar auto-pay"}'
```

{% hint style="info" %}
`charge-mandate` uses a `reference` per mandate. The same `reference` returns the earlier charge.
{% endhint %}

If a charge is over the limit, use a [payment request](broken://pages/b4162f1ed26296d48eab4a825a49a45e404587c9) with `mode: request`, or ask for a higher limit. The customer can revoke a mandate at any time. You get `mandate.revoked`.

To ask a customer to approve a recurring plan, see the [Subscriptions reference](file:///sirihduSQLZLwiPgqdx7/08c9d12f-863a-4aa7-9df8-1450285914df/api-reference/subscriptions.md).


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.biti.so/auto-pay.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
