PIX Automatic Payments
PIX Automatic is Netvalve's managed recurring billing feature for PIX — Brazil's instant payment platform operated by the Central Bank of Brazil. With a single QR code authorisation from your customer, Netvalve and FacilitaPay handle all subsequent charges automatically on your defined schedule.
PIX Automatic is available for payments in BRL (Brazilian Real) only. The customer must have a Brazilian bank account enrolled in PIX.
How it works
- Your server creates an order with a
recurringSchedulepayload, settingpaymentOptiontoapm_pix. - Netvalve creates the subscription and asynchronously generates a dynamic PIX QR code tied to the subscription lifecycle. The QR code is not returned in the create-order response — you retrieve it via the Inquiry API once it is ready.
- The customer scans the QR code once in their banking app and authorises the automatic debit. The subscription remains in
pendingstatus until this authorisation is completed. - The subscription becomes active after the customer authorises the debit. Subsequent charges occur automatically without any further customer action.
- Each automatic charge triggers a webhook notification. You receive events for each payment success, failure, and retry.
- The subscription ends when all billing cycles complete, or when cancelled by you or the customer.
Unlike a one-time dynamic PIX transaction — where the QR code is returned synchronously in the create-order response — a PIX Automatic subscription QR code is generated asynchronously and is tied to the subscription lifecycle. You must poll the Inquiry API to retrieve it once it is ready, then display it for the customer to scan. Do not expect apmPaymentInfo in the initial create-order response for subscriptions.
Subscription lifecycle
| Status | What triggers it |
|---|---|
pending | Subscription created; QR code is being generated asynchronously. Remains pending until the customer scans the QR code and authorises the automatic debit in their banking app. |
active | Customer scanned the QR code and authorised the automatic debit. Subsequent charges proceed automatically. |
canceled | Cancelled by the merchant, revoked by the payer, or all retry attempts exhausted |
completed | All billing cycles have been successfully processed |
Retry behaviour
If a charge fails due to insufficient funds or a temporary issue, Netvalve retries based on your configured failureAttempts setting (0–3 retries). Retries are scheduled every two days. Once all retries are exhausted without a successful payment, the subscription moves to canceled and a webhook notification is sent.
Invoice dates follow the subscription schedule strictly. If a scheduled date does not exist in a given month (for example, the 31st in February), the system adjusts to the last valid day of that month. The original date resumes in the following month.
This date-adjustment rule applies to MONTHLY, QUARTERLY, SEMESTER, and YEARLY frequencies only.
Prerequisites
Before going live with PIX Automatic:
- Contact the Netvalve team to enable PIX Automatic on your account.
- Ensure your MID is configured for BRL and PIX as a payment channel.
- Configure a webhook endpoint to receive subscription and payment event notifications — see the Webhook Message guide.
- Your
startDatemust be a future date. TheendDateis mandatory and must be at least 7 days afterstartDate(minimum weekly cycle).
Integration
PIX Automatic is available via both the Netvalve Hosted Payment Page (HPP) and the direct (merchant-hosted) integration mode.
- Hosted Payment Page
- Direct (merchant-hosted)
Step 1 — Create the subscription order
Send a POST request to the Create Order endpoint. Include a recurringSchedule object alongside the standard alternativePaymentMethod PIX fields.
{
"amount": 50.00,
"currency": "BRL",
"siteId": "f76fb7ed-3312-4791-a216-45918f899271",
"clientOrderId": "{{clientOrderId}}",
"orderDesc": "Monthly subscription — Basic Plan",
"successUrl": "https://merchantsite.com/success.html",
"cancelUrl": "https://merchantsite.com/cancel.html",
"failedUrl": "https://merchantsite.com/failed.html",
"pendingUrl": "https://merchantsite.com/pending.html",
"paymentOption": "apm_pix",
"alternativePaymentMethod": {
"paymentMethod": "pix",
"userType": "n",
"documentType": "cpf",
"documentNumber": "12345678901",
"socialName": "Pablo Castro",
"fiscalCountry": "Brasil",
"payerEmail": "pablo@example.com",
"payerPhone": "3001234567"
},
"recurringSchedule": {
"subscriptionName": "Basic Plan — Monthly",
"recurringPeriod": 30,
"recurringType": "MONTHLY",
"startDate": "2025-10-01 00:00:00",
"endDate": "2026-10-01 00:00:00",
"recurringAmount": 50.00,
"failureAttempts": 3
},
"customerDetails": {
"customerAddress": "Av. Paulista 1000",
"customerCity": "São Paulo",
"customerCountryCode": "BR",
"customerEmail": "pablo@example.com",
"customerIp": "123.123.123.123",
"customerName": "Pablo",
"customerLastName": "Castro",
"customerPhone": "+5511999990000",
"customerState": "SP",
"customerZipCode": "01310-100"
}
}
The number of billing cycles is derived automatically from your startDate, endDate, and recurringPeriod:
cycles = (endDate − startDate) / recurringPeriod
The result must be a whole number. Adjust your dates or period if the division is fractional.
Step 2 — Redirect the customer
On a successful response (responseCode: "GTW_1000"), redirect the customer to the redirectUrl. The Netvalve hosted page handles the asynchronous QR code generation and will display the PIX QR code and subscription summary once it is ready for the customer to authorise.
{
"traceID": "98e151b7-fca4-4e2a-8597-ab58512f2d41",
"responseTimestamp": "2025-09-09T06:54:38.626+00:00",
"orderId": 123445,
"transactionID": "txn-98e151b7",
"responseCode": "GTW_1000",
"responseMessage": "Transaction Approved / Request Successful.",
"orderState": "CREATED",
"redirectUrl": "https://checkout.uat.sandbox-netvalve.com?paymentToken=eyJ...",
"midId": "mid-4521",
"netvalveMidId": "f76fb7ed-3312-4791-a216-45918f899271"
}
To pre-select PIX on the hosted page, append &paymentOption=apm_pix to the redirectUrl.
Step 3 — Handle the redirect outcome
After the customer authorises (or abandons) the subscription, Netvalve redirects them to one of the URLs you provided:
| Outcome | Redirect target |
|---|---|
| QR code scanned and debit authorised | successUrl |
| Customer cancelled | cancelUrl |
| Authorisation failed | failedUrl |
| QR code generated but customer has not yet scanned or authorised | pendingUrl |
Step 4 — Receive webhooks
Netvalve sends a server-to-server webhook notification for:
- QR code ready for scanning
- Each subsequent automatic charge (success or failure)
- Subscription status changes (active, canceled, completed)
Contact the Netvalve team to register your webhook endpoint. See the Webhook Message guide for the full payload schema.
Step 1 — Create the subscription order
Set paymentMode to "direct" to receive the PIX QR code directly in the API response — Netvalve acts as a pass-through and the QR code is displayed on your own page.
{
"paymentMode": "direct",
"amount": 50.00,
"currency": "BRL",
"siteId": "f76fb7ed-3312-4791-a216-45918f899271",
"clientOrderId": "{{clientOrderId}}",
"orderDesc": "Monthly subscription — Basic Plan",
"successUrl": "https://merchantsite.com/success.html",
"cancelUrl": "https://merchantsite.com/cancel.html",
"failedUrl": "https://merchantsite.com/failed.html",
"pendingUrl": "https://merchantsite.com/pending.html",
"paymentOption": "apm_pix",
"alternativePaymentMethod": {
"paymentMethod": "pix",
"userType": "n",
"documentType": "cpf",
"documentNumber": "12345678901",
"socialName": "Pablo Castro",
"fiscalCountry": "Brasil",
"payerEmail": "pablo@example.com",
"payerPhone": "3001234567"
},
"recurringSchedule": {
"subscriptionName": "Basic Plan — Monthly",
"recurringPeriod": 30,
"recurringType": "MONTHLY",
"startDate": "2025-10-01 00:00:00",
"endDate": "2026-10-01 00:00:00",
"recurringAmount": 50.00,
"failureAttempts": 3
},
"customerDetails": {
"customerAddress": "Av. Paulista 1000",
"customerCity": "São Paulo",
"customerCountryCode": "BR",
"customerEmail": "pablo@example.com",
"customerIp": "123.123.123.123",
"customerName": "Pablo",
"customerLastName": "Castro",
"customerPhone": "+5511999990000",
"customerState": "SP",
"customerZipCode": "01310-100"
}
}
Step 2 — Retrieve the QR code from the Inquiry API
For PIX Automatic subscriptions, the QR code is generated asynchronously after the subscription is created. The create-order response does not include apmPaymentInfo; instead, it returns responseCode: "GTW_1002" (pending) confirming the subscription record has been created.
{
"traceID": "1b196e16-3a62-4116-947a-13d32400219f",
"responseTimestamp": "2025-10-01T09:02:44.402+00:00",
"transactionID": 10221,
"responseCode": "GTW_1002",
"responseMessage": "Transaction status is Pending.",
"responseCodeType": "PENDING",
"bankTransactionId": "b3ea62f3-823f-4152-90f0-94625ab87349",
"midId": 500,
"netvalveMidId": "5c9f43e2-0317-44ab-b169-b2a84ab9598c",
"processor": "PIX",
"amount": 50.00,
"currency": "BRL",
"transactionType": "SALE",
"apmType": "PIX"
}
Poll the Inquiry API using the transactionID (or your clientOrderId) until apmPaymentInfo appears in the response. Once the QR code is ready, the Inquiry response will include:
{
"transactionID": 10221,
"responseCode": "GTW_1002",
"responseCodeType": "PENDING",
"apmPaymentInfo": {
"qrCode": "<base64-encoded PNG>",
"qrCodeExpiry": "2025-10-01T09:07:41.019795"
}
}
Decode the apmPaymentInfo.qrCode value (Base64 PNG) and render it on your page. Display a countdown timer or expiry message based on apmPaymentInfo.qrCodeExpiry.
The subscription QR code expires approximately 15 minutes after it is generated. If the customer does not scan before expiry, you must create a new order to generate a fresh QR code. Do not attempt to reuse an expired QR code or the same clientOrderId.
Step 3 — Customer scans and authorises
Display the QR code to the customer and instruct them to scan it with their banking app to authorise the automatic debit. The subscription will remain in pending status until the customer completes this authorisation.
Once the customer scans the QR code and authorises the debit, Netvalve sends a webhook to your configured endpoint confirming the subscription is now active. After activation, all subsequent charges are made automatically according to the subscription frequency and cycles — no further action is required from the customer.
Do not mark the subscription as active in your own system until you receive this webhook or confirm the status change via the Inquiry API.
Step 4 — Handle subsequent charge webhooks
Each automatic charge (on the scheduled date) triggers a webhook notification. Process these to update your records and notify your customer as appropriate.
recurringSchedule field reference
| Field | Type | Required | Description |
|---|---|---|---|
subscriptionName | string | Yes | A human-readable label for this subscription. Shown in the Netvalve backoffice. |
recurringPeriod | integer | Yes | The interval between charges in days. Must align with recurringType. |
recurringType | string | Yes | Billing frequency. Allowed values: WEEKLY, MONTHLY, QUARTERLY, SEMESTER, YEARLY. DAILY is not supported for PIX. |
startDate | string | Yes | First charge date in YYYY-MM-DD HH:mm:ss format. Must be a future date. |
endDate | string | Yes | Final charge date. Must be at least 7 days after startDate. (endDate − startDate) / recurringPeriod must be a whole number. |
recurringAmount | decimal | Yes | Amount charged on each billing cycle (e.g. 50.00). Must have exactly 2 decimal places. |
failureAttempts | integer | No | Number of retry attempts after a failed charge. Range: 0–3. Defaults to 0. Retries are scheduled every 2 days. |
alternativePaymentMethod field reference (PIX)
| Field | Type | Required | Description |
|---|---|---|---|
paymentMethod | string | Yes | Always "pix" for PIX payments. |
userType | string | Yes | "n" for a natural person (individual), "j" for a juridical person (company). |
documentType | string | Yes | "cpf" for individuals, "cnpj" for companies. |
documentNumber | string | Yes | Brazilian tax ID — 11 digits for CPF, 14 digits for CNPJ. Digits only. |
socialName | string | Yes | Customer's full legal name as registered with their bank. |
fiscalCountry | string | Yes | Always "Brasil". |
payerEmail | string | Yes | Customer's email address for payment notifications. |
payerPhone | string | Yes | Customer's phone number. Brazilian format (e.g. "11999990000"). |
Validations
Netvalve applies the following validations before forwarding the subscription to FacilitaPay. Requests that fail these checks return a 4xx error with a descriptive message.
| Rule | Details |
|---|---|
startDate must be in the future | The subscription start date must be after the current date and time. |
endDate is mandatory | Subscriptions without an end date are not accepted for PIX. |
| Minimum duration of 7 days | endDate − startDate must be at least 7 days (one weekly cycle). |
| Whole-number cycle count | (endDate − startDate) / recurringPeriod must divide evenly. |
DAILY frequency not supported | Use WEEKLY as the shortest interval. |
| Currency must be BRL | PIX Automatic only supports Brazilian Real. |
| Valid Brazilian document number | CPF must be 11 digits; CNPJ must be 14 digits. |
failureAttempts range | Must be between 0 and 3 inclusive. |
Cancelling a subscription
You can cancel an active subscription from the Netvalve backoffice (Subscriptions menu) or via the Subscription API.
POST /subscriptions/{subscriptionId}/cancel
Customers can also revoke the automatic debit authorisation directly in their banking app. Netvalve will automatically update the subscription status to canceled.
Exception handling
Pending response
A responseCode of GTW_1002 with responseCodeType: "PENDING" is returned in two distinct situations for PIX Automatic subscriptions:
1 — QR code not yet generated (immediately after create-order)
The subscription has been created but the QR code is still being generated asynchronously. Poll the Inquiry API until apmPaymentInfo appears in the response, then display the QR code to the customer.
2 — QR code generated but not yet scanned
The QR code is available in apmPaymentInfo but the customer has not yet scanned it. Continue polling (or rely on the incoming webhook) until the subscription transitions to active.
{
"traceID": "965c2c75-b29d-41fc-aa3a-6d40b9f3fbb0",
"responseTimestamp": "2024-04-25T13:48:49.959+00:00",
"transactionID": 22,
"responseCode": "GTW_1002",
"responseMessage": "Transaction status is Pending.",
"responseCodeType": "PENDING"
}
Poll the Inquiry API no more than once every 5 seconds. Excessive polling may result in rate limiting. For production integrations, prefer webhooks over polling.
Expired QR code
If the customer does not scan the QR code before qrCodeExpiry, the order expires. Create a new order to generate a fresh QR code. Do not reuse the old clientOrderId — use a new unique identifier.
All retries exhausted
When all configured retry attempts fail, the subscription is automatically cancelled.
Related resources
| Resource | Link |
|---|---|
| PIX one-time payment | PIX Integration |
| Hosted Payment Page guide | Hosted Payment Page |
| Subscription management API | API Reference |
| Webhook events | Webhook Message |
| Error codes | Error Codes |
| Inquiry API | Inquiry API |