# Automatic PIX API

## Overview

Our Automatic PIX API creates subscription-style payments, generating QR Codes that customers scan to pay within a set period, including built-in logic for retries and cancellations to manage and track recurring customer payments automatically.\
\
This includes:

* **Initial Enrollment** - Create first-time deposit and/or determine start of an automatic PIX charge.
* **Recurring Payments** - A new QR Code is generated on a fixed time basis for each payment cycle.
* **Retry Logic** - Multiple instances to complete the transaction if any of the recurring attempts fail.
* **Status** - Obtain detailed information about each enrollment.
* **Cancellation** - Cancel any enrollment previously created.

### Basic Overview

The included endpoints are:\
\
**Start Enrollment** (<mark style="color:orange;">**`POST`**</mark> /v1/enrollments):&#x20;

* Initial deposit information is sent, with all the customer's information, the amount to be charged & other API info.
* Within this initial request, the time frequency that which this should be charged & if it has a first instant payment or not, is included.

**Recurring Payments** (<mark style="color:orange;">**`POST`**</mark> /v3/deposits):&#x20;

* A POST request containing the enrollment\_id and the exclusive IXA payment\_method is automatically submitted to the Deposits API at the end of each recurring period to process the next payment.

**Retry Logic** (<mark style="color:orange;">**`POST`**</mark> /v3/deposits/retry/{depositId}):&#x20;

* If any of the recurring payments failed/expired, you can use this endpoint in order to generate a new QR code tied to an existing attempt.

**Status Endpoint** (<mark style="color:green;">**`GET`**</mark> /v1/enrollments/{id}):&#x20;

* Provides you with all the information related to an enrollment ID.

**Cancellation Endpoint** (<mark style="color:orange;">**`POST`**</mark> /v1/enrollments/{enrollmentId}/cancel):&#x20;

* Allows you to cancel a previously created enrollment.

## Authentication Requirements

* **X-Login**: Your deposits merchant API key.
* **X-Date**: Current timestamp in ISO 8601 format.
* **Authorization**: Authentication hash.
* **Content-Type**: application/json.

All Automatic PIX API endpoints require and follow the same security aspects & headers used for deposits, [which can be found here.](/api-documentation/deposits-api/technical-and-security-aspects.md)<br>


---

# 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.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.
