Checkout Subscription — PIX Automático
The Checkout PIX Automático Subscription allows you to initiate a recurring payment agreement directly through our Checkout solution — either embedded (JavaScript widget) or via Redirect Checkout — without the need to call the Subscriptions API directly.
By passing the subscription-specific parameters to the Checkout, our platform will:
- Present the enrollment QR Code to the payer.
- Register the subscription in the Subscriptions Engine upon confirmation.
- Automate subsequent billing cycles according to the configured schedule.
For a deep dive into the full subscription lifecycle, status transitions, orchestration models, and dunning logic, refer to the Subscriptions Documentation. For PIX Automático-specific rules and scheduling windows, see PIX Automático.
Flow
Step-by-step
- Merchant initiates the Checkout solution with
method: "PIX"andsubscription: true. - The enrollment QR Code is presented to the customer.
- Customer scans the QR Code and confirms the recurring payment authorization in their banking app.
- epag registers the subscription and notifies the merchant via the
subscriptionNotificationUrl. - The Billing Engine automatically generates and processes charges according to the configured
subscriptionPeriodicity.
Frontend Integration
Include our JavaScript library in the <head> section of your HTML:
<script src="https://checkout-sandbox.epag.io/checkout-v0.1.js"></script>
Method I: HTML
<body>
<epag-checkout
amount="15.00"
asset="BRL"
reference-id="MY_REFERENCE_ID"
contract-id="MY_CONTRACT_ID"
subscription="true"
subscription-scheme="PIX_AUTOMATICO"
subscription-retry-policy="NOT_ALLOW"
subscription-amount-type="FIXED"
subscription-periodicity="WEEKLY"
subscription-amount="15.00"
subscription-asset="BRL"
subscription-due-date="2026-02-18"
subscription-end-date=""
subscription-force-work-day="false"
subscription-initial-charge="true"
subscription-merchant-initiation="false"
subscription-notification-url="https://my.notification.url/subscription"
subscription-description="My Subscription"
subscription-minimum-amount="0.01">
</epag-checkout>
</body>
Method II: JavaScript
const ePagCheckout = new EPagCheckout({
amount: 15.00,
asset: "BRL",
referenceId: "MY_REFERENCE_ID",
contractId: "MY_CONTRACT_ID",
subscription: true,
subscriptionScheme: "PIX_AUTOMATICO",
subscriptionRetryPolicy: "NOT_ALLOW",
subscriptionAmountType: "FIXED",
subscriptionPeriodicity: "WEEKLY",
subscriptionAmount: 15.00,
subscriptionAsset: "BRL",
subscriptionDueDate: "2026-02-18",
subscriptionEndDate: null,
subscriptionForceWorkDay: false,
subscriptionInitialCharge: true,
subscriptionMerchantInitiation: false,
subscriptionNotificationUrl: "https://my.notification.url/subscription",
subscriptionDescription: "My Subscription",
subscriptionMinimumAmount: 0.01,
});
ePagCheckout.mountIn('#checkout-container-element');
Redirect Checkout
You can also create a PIX Automático subscription via the Redirect Checkout endpoint, which generates a hosted checkout URL with the subscription parameters.
POST https://api-sandbox.epag.io/checkout/generate
Authorization
| Header | Value |
|---|---|
| X-Auth-Token | MY_ACCESS_TOKEN |
Example Request
- Enrollment Only
- Enrollment + Initial Charge
- Enrollment Only and Variable Amount
Request
{
"contractId": "MY_CONTRACT_ID",
"paymentCountry": "BR",
"paymentCurrency": "BRL",
"notificationUrl": "https://my.notification.url/payment",
"subscription": true,
"subscriptionScheme": "PIX_AUTOMATICO",
"subscriptionRetryPolicy": "NOT_ALLOW",
"subscriptionAmountType": "FIXED",
"subscriptionPeriodicity": "WEEKLY",
"subscriptionAmount": 15.00,
"subscriptionAsset": "BRL",
"subscriptionDueDate": "2026-02-18",
"subscriptionEndDate": null,
"subscriptionForceWorkDay": false,
"subscriptionInitialCharge": false,
"subscriptionMerchantInitiation": false,
"subscriptionNotificationUrl": "https://my.notification.url/subscription",
"subscriptionDescription": "My Subscription"
}
Response
{
"url": "MY_CHECKOUT_URL",
"expires_at": "2026-02-16T10:00:00.000",
"refresh_token": "MY_ACCESS_TOKEN"
}
Request
{
"amount": 35.00,
"asset": "BRL",
"referenceId": "MY_REFERENCE_ID",
"contractId": "MY_CONTRACT_ID",
"paymentCountry": "BR",
"paymentCurrency": "BRL",
"notificationUrl": "https://my.notification.url/payment",
"subscription": true,
"subscriptionScheme": "PIX_AUTOMATICO",
"subscriptionRetryPolicy": "NOT_ALLOW",
"subscriptionAmountType": "FIXED",
"subscriptionPeriodicity": "WEEKLY",
"subscriptionAmount": 15.00,
"subscriptionAsset": "BRL",
"subscriptionDueDate": "2026-02-18",
"subscriptionEndDate": null,
"subscriptionForceWorkDay": false,
"subscriptionInitialCharge": true,
"subscriptionMerchantInitiation": false,
"subscriptionNotificationUrl": "https://my.notification.url/subscription",
"subscriptionDescription": "My Subscription"
}
When subscriptionInitialCharge is true, the QR Code presented to the customer will embed two actions in a single scan:
- Authorization of the recurring PIX Automático agreement.
- An immediate first charge of
amountandasset.
Response
{
"url": "MY_CHECKOUT_URL",
"expires_at": "2026-02-16T10:00:00.000",
"refresh_token": "MY_ACCESS_TOKEN"
}
Request
{
"contractId": "MY_CONTRACT_ID",
"paymentCountry": "BR",
"paymentCurrency": "BRL",
"notificationUrl": "https://my.notification.url/payment",
"subscription": true,
"subscriptionScheme": "PIX_AUTOMATICO",
"subscriptionRetryPolicy": "NOT_ALLOW",
"subscriptionAmountType": "VARIABLE",
"subscriptionPeriodicity": "WEEKLY",
"subscriptionDueDate": "2026-02-18",
"subscriptionEndDate": null,
"subscriptionForceWorkDay": false,
"subscriptionInitialCharge": false,
"subscriptionNotificationUrl": "https://my.notification.url/subscription",
"subscriptionDescription": "My Subscription",
"subscriptionMinimumAmount": 0.01
}
Response
{
"url": "MY_CHECKOUT_URL",
"expires_at": "2026-02-16T10:00:00.000",
"refresh_token": "MY_ACCESS_TOKEN"
}
Configuration Options
Subscription Parameters
The following parameters activate and configure the PIX Automático recurring payment. They are passed alongside the standard Checkout parameters.
| HTML Attribute | JS Prop | Type | Required | Default | Description |
|---|---|---|---|---|---|
subscription | subscription | boolean | yes | false | Set to true to enable the subscription enrollment flow. |
subscription-scheme | subscriptionScheme | string | yes | n/a | The subscription payment scheme. Value: PIX_AUTOMATICO. |
subscription-retry-policy | subscriptionRetryPolicy | string | yes | n/a | Retry/dunning policy for failed charges. Values: NOT_ALLOW, ALLOW_3_RETRIES_7_DAYS. |
subscription-amount-type | subscriptionAmountType | string | yes | n/a | Defines whether the recurring amount is fixed or variable. Values: FIXED, VARIABLE. |
subscription-periodicity | subscriptionPeriodicity | string | yes | n/a | Billing frequency. Values: WEEKLY, MONTHLY, QUARTERLY, HALF_YEARLY, YEARLY. |
subscription-amount | subscriptionAmount | number | yes* | n/a | The recurring charge value. Required when subscriptionAmountType is FIXED. |
subscription-asset | subscriptionAsset | string | yes* | BRL | Currency asset for the recurring charge (e.g., BRL). Required when subscriptionAmountType is FIXED. |
subscription-due-date | subscriptionDueDate | YYYY-MM-DD | yes | n/a | The first due date for the subscription. Must be at least Today + 2 days due to PIX Automático scheduling windows. |
subscription-end-date | subscriptionEndDate | YYYY-MM-DD | no | null | End date of the subscription. Use null for open-ended subscriptions. |
subscription-force-work-day | subscriptionForceWorkDay | boolean | no | false | If true, adjusts due dates falling on non-business days to the next business day. |
subscription-initial-charge | subscriptionInitialCharge | boolean | no | false | If true, bundles an immediate first charge into the enrollment QR Code. |
subscription-merchant-initiation | subscriptionMerchantInitiation | boolean | yes* | false | If false, the Billing Engine drives the lifecycle automatically (recommended for FIXED amounts). If true, the merchant is responsible for triggering each billing cycle. Required when subscriptionAmountType is FIXED |
subscription-notification-url | subscriptionNotificationUrl | string | no | n/a | URL to receive webhook callbacks for subscription lifecycle events (enrollment, status changes). |
subscription-description | subscriptionDescription | string | no | n/a | Description shown on the payer's bank statement for the recurring charges. |
subscription-minimum-amount | subscriptionMinimumAmount | number | no | n/a | Minimum charge amount allowed for variable subscriptions. |
Due to PIX Automático's mandatory 8-day scheduling window, subscriptionDueDate must be set to at least 2 days after the current date (Today + 2).
Retry Policy Reference
| Value | Description |
|---|---|
NOT_ALLOW | No retries. A single charge attempt is made on the due date. |
ALLOW_3_RETRIES_7_DAYS | Up to 3 retry attempts within a 7-day window after the initial failure. |
Orchestration Models
subscriptionMerchantInitiation | Model | Best For |
|---|---|---|
false | Engine-Driven — The Billing Engine automatically schedules and executes all recurring charges. | Standard plans with FIXED amounts (e.g., memberships, SaaS). |
true | Merchant-Driven — The merchant must trigger each billing cycle via the Create Charge API. | Variable-amount billing or custom scheduling needs. |
Events
The following events are relevant when integrating PIX Automático Subscription through the Checkout widget:
| Event Name | When |
|---|---|
checkout-success | Emitted when the enrollment QR Code is successfully confirmed by the payer. |
checkout-ready | Emitted when the checkout modal is ready. |
checkout-dismissed | Emitted when the checkout modal is closed by the user. |
checkout-error | Emitted when an unexpected error occurs. |
pix-copy | Emitted when the payer copies the PIX/enrollment code. |
pix-complete-purchase | Emitted when the payer clicks the complete button after scanning. |
Handling Events
const ePagCheckout = new EPagCheckout({ /* ... */ });
ePagCheckout.on('checkout-success', function(event) {
const data = event.detail[0];
console.log('Subscription enrolled! Payment token:', data.payment_token);
});
ePagCheckout.on('checkout-error', function(event) {
console.error('Enrollment error:', event.detail[0]);
});