# Recurring Payment Endpoint

## Deposit Creation

<mark style="color:green;">`POST`</mark> `https://api-stg.onekeypayments.com/v3/deposits`

In order to create recurring payments, we utilize the same endpoint as for regular deposits, with additional mandatory fields, in order to identify the enrollment and the date.\
\
All detailed information for the deposits API can be found [here.](/api-documentation/deposits-api.md)

#### Headers

| Name              | Type   | Description                                                                    |
| ----------------- | ------ | ------------------------------------------------------------------------------ |
| Content-Type      | string | `application/json`                                                             |
| X-Date            | string | <p>ISO8601 Datetime with Timezone: <br><code>yyyy-MM-dd'T'HH:mm:ssZ</code></p> |
| X-Login           | string | Merchant X-Login API Key                                                       |
| Authorization     | string | Authorization control hash                                                     |
| X-Idempotency-Key | string | Unique idempotency key                                                         |

### Recurring Payment Fields

| Name                       | Type   | Description                                                                                                                                          |
| -------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| enrollment                 | object | Contains the ID and Date                                                                                                                             |
| enrollment.id              | number | ID of the previously created enrollment. Can be obtained with [this endpoint.](/api-documentation/automatic-pix-api/enrollment-creation-endpoint.md) |
| enrollment.scheduled\_date | date   | Scheduled date of the payment, format YYYY-MM-DD                                                                                                     |

This additional object needs to be included, together with the deposits API fields, in order to create an instance for the customer to pay an automatic PIX. Fields can be [found here.](/api-documentation/deposits-api/endpoints/deposit-creation-endpoint.md#request-body)

### Example Request

```json
{
"invoice_id": "invoiceid10000",
"country": "BR",
"currency": "BRL",
"payment_method": "IXA",
"payer": 
{
    "first_name": "Ricardo",
    "last_name": "Carlos",
    "document": "01234567890",
    "document_type": "CPF",
    "email": "ricardo.carlos@example.com",
    "phone": "+5511999999999"
},
"amount": 1,
"success_url": "https://merchant.com/payment/success",
"notification_url": "https://merchant.com/payment/notification",
"back_url": "https://merchant.com/payment/back",
"error_url": "https://merchant.com/payment/error",
"enrollment": 
{
    "id": 30,
    "scheduled_date": "2025-11-22"
}
}
```

{% hint style="info" %}
The ID from the enrollment must be acquired from a previously created enrollment; the scheduled date is the date by which the payment needs to be completed by the customer.
{% endhint %}

### Status & Flow

\
As this works exactly the same as our deposits API, both for the payment flow and the usage of our APIs, the status for each transaction can be handled with our [deposit status endpoint](/api-documentation/deposits-api/endpoints/deposit-status-endpoint.md), and [notification](/api-documentation/deposits-api/endpoints/deposit-creation-endpoint/notifications.md) info is also handled in the same manner.


---

# Agent Instructions: 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://apidocs.onekeypayments.com/api-documentation/automatic-pix-api/recurring-payment-endpoint.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.
