Pix Automático Variable Enrollments
Pix Automático works by establishing an authorization, achieved through an enrollment process, between merchant and customer, and referencing it in every recurring payment. This way, the customer's bank can validate the payment against the enrollment and transfer funds without the need for customer interaction, given that they know the payment request has been validated and comes from a valid source.

A more versitile form of Pix Automático enrollments are variable subscriptions, where the merchant and customer agree on a value range that the recurring payment can vary. Typically, this is used in consumption based subscription models, but can also be used to adjust prices over time, to compensate for variations like inflation, FX or interest rates.
By following this basic integration guide, you will understand how you can create enrollments and accept Pix Automático recurring payments in your check-out, by using EBANX Direct API. To complete a payment with Pix Automático you will need a few API calls that will create an enrollment for your customer, the recurring payment and provide the necessary information for the customer to complete the transaction.
Requirements
- EBANX Sandbox Account - Provides a test environment where you can explore our payment solutions.- Sign up for an EBANX Sandbox Account.
- Complete the online form.
- Our team will reach out to you shortly.
 
- API credentials - Ensure you have your EBANX integration key. If not, complete the Merchant Signup Form.
Instructions
To complete a Pix Automático enrollment and recurring payments, please follow the steps below .
- Call the /ws/userenrollment API to get the Enrollment QR Code- Pix Automático generates a QR Code, which is scanned by the user in their banking app of choice. To get this, you just need to call the end-point - /ws/userenrollment(server-side) with the following fields:- Basic parameters- Parameter - Requirement - Description - integration_key- Required - Your integration key - payment_type_code- Required - Must be - pix-automatico- operation- Required - Must be - enrollment- expiration_time_in_seconds- Optional - QR code expires based on the duration specified in this parameter or the default set by EBANX (24 hours). The time must be specified in seconds. - Enrollment data- Parameter - Requirement - Description - country- Required - Must be - BR- email- Required - Customer e-mail - name- Required - Customer name - document- Required - Customer document - merchant_enrollment_code- Required - Unique enrollment code - subscription_name- Required - Descriptor of the service being provided, which will be displayed in the customer's banking app - expiration_date- Optional - If necessary, defines when the enrollment is no longer valid and no further payments will be charged - frequency- Required - The billing cycle of the enrollment. 
 Available frequencies are:- weekly,- monthly,- quarterly,- halfyealy,- yearly- retry- Required - Determines whether the merchant will retry payments that fail on the expect billing day. 
 The available retry policies are:- not_allowedfor no additional attempts or- allow_3R_7Dfor up to three retries within seven days after the first payment- max_amount_floor- Optional - Provided when recurring payments have a variable value - the maximum value will be set by the customer in their bank app, but can't be lower than this value. For fixed enrollments, use - fixed_amountinstead- start_date- Required - Day when the payment that initiates the subscription will be charged - Sample request- curl -X POST 'https://sandbox.ebanx.com/ws/userenrollment' \
 --header 'Content-Type: application/json' \
 --data '{
 {
 "integration_key": "{{integration_key}}",
 "payment_type_code": "pix-automatico",
 "operation": "enrollment",
 "expiration_time_in_seconds": 3600,
 "enrollment": {
 "country": "BR",
 "email": "{{customer_email}}",
 "name": "{{customer_name}}",
 "document": "{{customer_document}}",
 "merchant_enrollment_code": "{{unique_enrollment_code}}",
 "subscription": {
 "subscription_name": "Descriptor of the subscription.",
 "expiration_date": "2025-12-30",
 "frequency": "monthly",
 "retry": "allow_3R_7D",
 "fixed_amount": null,
 "max_amount_floor": 100,
 "start_date": "2024-12-15"
 }
 }
 }'- A successful request will return a JSON response like the one below. The Pix Automático raw QR Code value will be in the parameter - qr_code_value.- You can also use the - redirect_urlto redirect your customer to an external page to display the Pix Automatico voucher and QR code. In Sandbox environment, you will find in the- redirect_urlthe link to use our Simulator.- {
 "status": "SUCCESS",
 "redirect_url": "https://sandbox.ebanx.com/ewallet/recurrency-agreement?return_url=https%3A%2F%2Fsandbox.ebanx.com%2Fws%2Fcustomerenrollment-finish%2Ffake%3Fenrollment%3DMTYwOTA6bXktZW5yb2xsbWVudC0zMzA%253D&enrollment_uuid=PpKBQFh3wwa4agh9e",
 "enrollment": {
 "merchant_enrollment_code": "{{unique_enrollment_code}}",
 "country": "BR",
 "name": "{{customer_name}}",
 "email": "{{customer_email}}",
 "subscription": {
 "frequency": "monthly",
 "expiration_date": "2025-12-30",
 "subscription_name": "Descriptor of the subscription.",
 "start_date": "2024-12-15",
 "retry": "allow_3R_7D",
 "max_amount_floor": "100.00",
 "qr_code_value": "00020101021226780014br.gov.bcb.pix2556fake-pix.com.br/qr/v2/ACA4311F88661BC0D48200487EF1BCD95204000053039865802BR5910FAKEPIX Ltda6008CURITIBA62070503***36923"
 }
 }
 }
- Presenting the Pix QR Code- You can present the QR code by rendering the code at your page.  Copying QR Code to Clipboard Copying QR Code to Clipboard- Alternatively, you can simply deliver the QR Code number from - qr_code_valueto your customer's clipboard so they can paste it into their banking/wallet app.- At this point you have a - pendingenrollment and will be notified via webhook when there is a status change.
- Confirming the Enrollment- As soon as the enrollment is confirmed by the customer in their banking app, the enrollment status is modified from - pedingto- acceptedand a Status Update notification is sent to the URL defined in your merchant configuration.- {
 "operation":"enrollment_status_change",
 "notification_type":"update",
 "merchant_enrollment_code":"{{unique_enrollment_code}}"
 }- Using the ID provided in - merchant_enrollment_code, use the- /ws/userenrollments/queryendpoint to get the latest status of the enrollment.- Check the example: - curl -X POST 'https://sandbox.ebanx.com/ws/userenrollments/query' \
 --header 'Content-Type: application/json' \
 --data '{
 "integration_key": "{{integration_key}}",
 "enrollment": {
 "merchant_enrollment_code": "{{unique_enrollment_code}}"
 }
 }'- A successful request will return a JSON response like the one below, with a status of - acceptedfor the enrollment approved by the customer. Other possible enrollment statuses include- not accepted,- pending,- expired,- not_foundand- revoked, depending on the actions taken by the merchant or customer.- {
 "status": "SUCCESS",
 "enrollment": {
 "status": "accepted",
 "email": "{{customer_email}}"
 },
 "subscription": {
 "subscription_name": "Descriptor of the subscription.",
 "start_date": "2024-12-15",
 "expiration_date": "2025-12-30",
 "frequency": "monthly",
 "max_amount_floor": 100.00,
 "retry": "allow_3R_7D"
 }
 }Important:- Pending enrollments expire by default after 24 hours. If the customer does not complete the process in time, the enrollment will be marked as expired. You can override this behavior by setting the field - expiration_time_in_seconds, which defines the QR code expiration time for each request.
- Call the /ws/direct API to schedule the Pix Automático paymentVery Important!- The recurring payment request must be sent between 2 and 10 days before the expected billing day. For example, if a payment is due on January 17th, the payment request must be sent no earlier than January 7th and no later than January 15th. - Scheduling a recurring payment with Pix Automático is really straightforward. The following fields will be required: - Parameter - Requirement - Description - operation- Required - Must be - request- merchant_payment_code- Required - Unique merchant payment code - amount_total- Required - Total amount to be charged. Note that the amount must match the one set in the enrollment - currency_code- Required - Must be - BRL- country- Required - Must be - BR- payment_type_code- Required - Must be - pix-automatico- email- Required - Customer e-mail - name- Required - Customer name - document- Required - Customer document - due_date- Required - Expected billing date (DD/MM/YYYY) - it must be between 2 and 10 days after the current date - merchant_enrollment_code- Required - The enrollment code generated in the previous steps. The enrollment must have a - acceptedstatus to be used in recurring payments- Check the example: - curl -X POST 'https://sandbox.ebanx.com/ws/direct' \
 --header 'Content-Type: application/json' \
 --data '{
 "integration_key": "{{integration_key}}",
 "operation": "request",
 "payment": {
 "merchant_payment_code": {{merchant_payment_code}},
 "amount_total": 19.90,
 "currency_code": "BRL",
 "country": "BR",
 "payment_type_code": "pix-automatico",
 "email": "{{customer_email}}",
 "name": "{{customer_name}}",
 "document": "{{customer_document}}",
 "due_date": "17/01/2024",
 "enrollment": {
 "merchant_enrollment_code": "{{merchant_enrollment_code}}"
 }
 }
 }'- A successful request will return a JSON response like the one below. The Pix Automático payment will have a pending ( - PE) status and will be confirmed later by the customer's bank.- {
 "payment": {
 "hash": "{{unique_payment_hash}}",
 "country": "BR",
 "merchant_payment_code": "{{unique_payment_code}}",
 "status": "PE",
 "status_date": "2024-01-17 21:11:36",
 "open_date": "2024-01-10 13:00:00",
 "confirm_date": null,
 "transfer_date": null,
 "amount_br": "19.90",
 "amount_ext": "19.90",
 "amount_iof": "0.00",
 "currency_rate": "1.0000",
 "currency_ext": "BRL",
 "due_date": "2024-01-17",
 "payment_type_code": "pix-automatico",
 "redirect_url": "https://sandbox.ebanx.com/ws/redirect?hash=683f3c53c065aab9b5151a38cd6b717e29df06dcb60cbb3c",
 "pre_approved": false,
 "enrollment": {
 "status": "accepted",
 "merchant_enrollment_code": "{{unique_enrollment_code}}",
 },
 "subscription": {
 "subscription_name": "Descriptor of the subscription.",
 "start_date": "2024-12-15",
 "expiration_date": "2025-12-30",
 "frequency": "monthly",
 "max_amount_floor": 100.00,
 "retry": "allow_3R_7D"
 },
 "retries": {
 "retry_status": "LOCKED",
 "available_retries": 3,
 "payment_attempts": [
 {
 "attempted_at": "2024-01-17 21:11:33",
 "attempt_response": "PENDING"
 }
 ]
 }
 },
 "status": "SUCCESS"
 }note- In the Sandbox environment, the - redirect_urlin the response of your payment schedule will lead you to the payment Simulator, allowing you to reproduce multiple payment processing scenarios.
- Confirming the Payment- As soon as the payment is confirmed by the customer's bank, the payment status is modified from - PEto- COand a Status Update notification is sent.- {
 "operation":"payment_status_change",
 "notification_type":"update",
 "merchant_payment_code":"{{unique_payment_code}}"
 }- Using the - hashprovided in the payment response, use the- /ws/queryendpoint to get the latest status of the payment.- Check the example: - curl -X POST 'https://sandbox.ebanx.com/ws/query' \
 --header 'Content-Type: application/json' \
 --data '{
 "integration_key": "{{integration_key}}",
 "hash": "{{unique_payment_hash}}"
 }'- A successful request will return a JSON response like the one below, with a status of - COfor the successful recurring payment.- {
 "payment": {
 "hash": "{{unique_payment_hash}}",
 "country": "BR",
 "merchant_payment_code": "{{unique_payment_code}}",
 "status": "CO",
 "status_date": "2024-01-17 21:11:36",
 "open_date": "2024-01-10 13:00:00",
 "confirm_date": null,
 "transfer_date": null,
 "amount_br": "19.90",
 "amount_ext": "19.90",
 "amount_iof": "0.00",
 "currency_rate": "1.0000",
 "currency_ext": "BRL",
 "due_date": "2024-01-17",
 "payment_type_code": "pix-automatico",
 "redirect_url": "https://sandbox.ebanx.com/ws/redirect?hash=683f3c53c065aab9b5151a38cd6b717e29df06dcb60cbb3c",
 "pre_approved": false,
 "transaction_status": {
 "acquirer": "EBANX IP",
 "code": "OK",
 "description": "Recurring payment successfully paid",
 "description_code": "ACCEPTED"
 },
 "enrollment": {
 "status": "accepted",
 "merchant_enrollment_code": "{{unique_enrollment_code}}",
 },
 "subscription": {
 "subscription_name": "Descriptor of the subscription.",
 "start_date": "2024-12-15",
 "expiration_date": "2025-12-30",
 "frequency": "monthly",
 "max_amount_floor": 100.00,
 "retry": "allow_3R_7D"
 },
 "retries": {
 "retry_status": "ENDED",
 "available_retries": 0,
 "payment_attempts": [
 {
 "attempted_at": "2024-01-17 21:11:33",
 "attempt_response": "CONFIRMED"
 }
 ]
 }
 },
 "status": "SUCCESS"
 }- Now, for each new billing cycle, simply repeat 5 and 6! 
Still need help?
We hope this article was helpful. If you still have questions, you can explore the following options:
- Merchant support: Contact our support team at integration@ebanx.com for assistance.
- Not a partner yet? Please complete the Merchant Signup Form, and our commercial team will reach out to you.