Create Subscription
POST https://api-sandbox.letpay.io/subscriptions
This HTTP POST request is used to create a Subscription using the Credit Card scheme. Depending on the enrollment strategy (new card vs. existing token) and the amount type (Fixed vs. Variable), the payload structure varies slightly.
Request Body Parameters
The request payload includes the following core fields:
contract_id(required/string): Merchant's contract id.reference_id(required/string/max 45 chars): External code created by the merchant to reference this subscription.notification_url(required/string): URL to post callbacks regarding this subscription's status.amount(required for FIXED/float): The recurring charge value. Omitted whenamount_typeisVARIABLE.asset(optional/string): Asset code (Default:BRL). Omitted whenamount_typeisVARIABLE.amount_type(required/enum): Defines the nature of the recurring amount. Values:FIXEDorVARIABLE.scheme(required/enum): The payment method. Value:CREDIT_CARD.retry_policy(required/enum): The ID of the retry policy to be applied. Values:NOT_ALLOW,ALLOW_3_RETRIES_7_DAYS,ALLOW_8DAYS_4,ALLOW_3WEEKS_5,ALLOW_P2_BACKOFF_16,CUSTOM.merchant_initiation(optional/boolean): Flag to indicate if the merchant controls the billing trigger. Required whenamount_typeisVARIABLE.schedule(required/object): Defines the recurrence rules:due_date(required/date): The due date of the first billing cycle (YYYY-MM-DD).end_date(optional/date): The end date. Usenullfor open-ended subscriptions.periodicity(required/enum): Frequency of the cycle. Values:DAILY,WEEKLY,BI_WEEKLY,MONTHLY,QUARTERLY,HALF_YEARLY,YEARLY,CUSTOM.custom_period(conditional/object): Required whenperiodicityisCUSTOM.period(required/string): The time unit. Values:"day","month".count(required/integer): The interval count (e.g.,2for every 2 months).
force_work_day(required/boolean): Iftrue, adjusts due dates to the next business day when they fall on weekends or holidays.
payment(required/object): The payment execution data:notification_url(required/string): URL to post callbacks regarding individual payments.country(required/string): Country code (e.g.,BR).currency(required/string): Currency code (e.g.,BRL).card(required/object): Card enrollment data. Use one of the following strategies:- New Card (tokenization):
holder_name(required/string): Name as printed on the card.number(required/string): Card number (PAN).expiry_month(required/string): Two-digit expiry month (e.g.,"12").expiry_year(required/string): Four-digit expiry year (e.g.,"2027").cvv(required/string): Card security code.tax_id(required/string): Payer's tax identifier. BR: CPF/CNPJ. LATAM: national ID.first_name(required for LATAM/string): Payer's first name.surname(required for LATAM/string): Payer's last name.email(required for LATAM/string): Payer's email address.
- Existing Token:
public_person_id(required/string): ePag's public identifier for the payer.public_card_id(required/string): ePag's public identifier for the card token.
- New Card (tokenization):
Scenario-Specific Fields
1. For FIXED Amount Subscriptions:
amount(required/float): The recurring charge value.asset(optional/string): Asset code (Default:BRL).
2. For VARIABLE Amount Subscriptions:
- The
amountandassetfields are omitted at the root level, as the value changes per cycle. merchant_initiationmust be set totrue.
Authorization
| Header | Value |
|---|---|
| X-Auth-Token | MY_ACCESS_TOKEN |
Body Raw (JSON)
{
"contract_id": "{{contractId}}",
"reference_id": "S-{{$guid}}",
"notification_url": "{{notificationUrl}}",
"amount": "15.00",
"asset": "BRL",
"amount_type": "FIXED",
"schedule": {
"due_date": "2026-03-25",
"end_date": null,
"periodicity": "DAILY"
},
"scheme": "CARD",
"retry_policy": "ALLOW_5_RETRIES_3_WEEKS",
"merchant_initiation": false,
"payment": {
"initial_charge": {
"amount": "88.00",
"asset": "BRL",
"reference_id": "IC-{{$guid}}"
},
"notification_url": "{{notificationUrl}}",
"country": "BR",
"currency": "BRL",
"card": {
"number": "{{cardNumber}}",
"cvv": "{{cardCvv}}",
"month": "{{cardMonth}}",
"year": "{{cardYear}}",
"holder": "{{cardHolder}}",
"public_person_id": "{{publicPersonId}}",
"public_card_id": "{{publicCardId}}"
},
"person": {
"tax_id": "{{personTaxId}}",
// "tax_id_type": "NIT",
"full_name": "{{personFullName}}",
"email": "{{personEmail}}"
}
}
}
Example Request
- New Card – Fixed Amount
- Existing Token – Fixed Amount
- Variable Amount
- Custom Periodicity
New Card – Fixed Amount
curl --location 'https://api-sandbox.letpay.io/subscriptions' \
--header 'X-Auth-Token: MY_ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"contract_id": "MY_CONTRACT_ID",
"reference_id": "MY_REFERENCE_ID",
"notification_url": "https://my.notification.url/subscription",
"amount": "15.00",
"asset": "BRL",
"amount_type": "FIXED",
"schedule": {
"due_date": "2026-03-25",
"end_date": null,
"periodicity": "DAILY"
},
"scheme": "CARD",
"retry_policy": "ALLOW_5_RETRIES_3_WEEKS",
"merchant_initiation": false,
"payment": {
"initial_charge": {
"amount": "88.00",
"asset": "BRL",
"reference_id": "MY_REFERENCE_ID"
},
"notification_url": "https://my.notification.url/payment",
"country": "BR",
"currency": "BRL",
"card": {
"number": "MY_CARD_NUMBER",
"cvv": "MY_CARD_CVV",
"month": "MY_CARD_MONTH",
"year": "MY_CARD_YEAR",
"holder": "MY_CARD_HOLDER",
"public_person_id": "MY_PUBLIC_PERSON_ID",
"public_card_id": "MY_PUBLIC_CARD_ID"
},
"person": {
"tax_id": "MY_PERSON_TAX_ID",
// "tax_id_type": "NIT",
"full_name": "MY_PERSON_FULL_NAME",
"email": "MY_PERSON_EMAIL"
}
}
}'
Example Response
Header
Content-Type: application/json
200 OK
{
"subscription_id": "cc6effd7-2100-47ee-b483-5b4ac719f97d",
"reference_id": "MY_REFERENCE_ID",
"status": "ACTIVE",
"refresh_token": "MY_ACCESS_TOKEN"
}
Existing Token – Fixed Amount
curl --location 'https://api-sandbox.letpay.io/subscriptions' \
--header 'X-Auth-Token: MY_ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"contract_id": "MY_CONTRACT_ID",
"reference_id": "MY_REFERENCE_ID",
"notification_url": "https://my.notification.url/subscription",
"amount": "15.00",
"asset": "BRL",
"amount_type": "FIXED",
"schedule": {
"due_date": "2025-11-23",
"end_date": null,
"periodicity": "MONTHLY",
"force_work_day": false
},
"scheme": "CREDIT_CARD",
"retry_policy": "NOT_ALLOW",
"merchant_initiation": false,
"payment": {
"notification_url": "https://my.notification.url/payment",
"country": "BR",
"currency": "BRL",
"card": {
"public_person_id": "MY_PUBLIC_PERSON_ID",
"public_card_id": "MY_PUBLIC_CARD_ID"
}
}
}'
Example Response
Header
Content-Type: application/json
200 OK
{
"subscription_id": "cc6effd7-2100-47ee-b483-5b4ac719f97d",
"reference_id": "MY_REFERENCE_ID",
"status": "ACTIVE",
"refresh_token": "MY_ACCESS_TOKEN"
}
Variable Amount
curl --location 'https://api-sandbox.letpay.io/subscriptions' \
--header 'X-Auth-Token: MY_ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"contract_id": "MY_CONTRACT_ID",
"reference_id": "MY_REFERENCE_ID",
"notification_url": "https://my.notification.url/subscription",
"amount_type": "VARIABLE",
"schedule": {
"due_date": "2025-11-23",
"end_date": null,
"periodicity": "MONTHLY",
"force_work_day": false
},
"scheme": "CREDIT_CARD",
"retry_policy": "NOT_ALLOW",
"merchant_initiation": true,
"payment": {
"notification_url": "https://my.notification.url/payment",
"country": "BR",
"currency": "BRL",
"card": {
"public_person_id": "MY_PUBLIC_PERSON_ID",
"public_card_id": "MY_PUBLIC_CARD_ID"
}
}
}'
Example Response
Header
Content-Type: application/json
200 OK
{
"subscription_id": "cc6effd7-2100-47ee-b483-5b4ac719f97d",
"reference_id": "MY_REFERENCE_ID",
"status": "ACTIVE",
"refresh_token": "MY_ACCESS_TOKEN"
}
Custom Periodicity (every 45 days)
curl --location 'https://api-sandbox.letpay.io/subscriptions' \
--header 'X-Auth-Token: MY_ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"contract_id": "MY_CONTRACT_ID",
"reference_id": "MY_REFERENCE_ID",
"notification_url": "https://my.notification.url/subscription",
"amount": "29.90",
"asset": "BRL",
"amount_type": "FIXED",
"schedule": {
"due_date": "2025-11-23",
"end_date": null,
"periodicity": "CUSTOM",
"custom_period": {
"period": "day",
"count": 45
},
"force_work_day": false
},
"scheme": "CREDIT_CARD",
"retry_policy": "ALLOW_3_RETRIES_7_DAYS",
"merchant_initiation": false,
"payment": {
"notification_url": "https://my.notification.url/payment",
"country": "BR",
"currency": "BRL",
"card": {
"public_person_id": "MY_PUBLIC_PERSON_ID",
"public_card_id": "MY_PUBLIC_CARD_ID"
}
}
}'
Example Response
Header
Content-Type: application/json
200 OK
{
"subscription_id": "cc6effd7-2100-47ee-b483-5b4ac719f97d",
"reference_id": "MY_REFERENCE_ID",
"status": "ACTIVE",
"refresh_token": "MY_ACCESS_TOKEN"
}