Skip to main content

Create subscription

POST/api/v1/bank/wallet/charge/Bearer Token
Subscription via charge endpoint

Subscriptions are created by including a subscription object in the Create charge request body. The first charge is processed immediately, and subsequent charges are created automatically based on the billing cycle.


Request headers​

HeaderValueRequired
AuthorizationBearer {A55_ACCESS_TOKEN}Yes
Content-Typeapplication/jsonYes
Idempotency-KeyUUID v4Recommended

Request body​

All Create charge fields apply, plus the subscription object:

FieldTypeRequiredDescription
type_chargestringYesMust be credit_card or debit_card
subscription.cyclestringYesBilling cycle — see table below
subscription.end_datestringNoEnd date YYYY-MM-DD (omit for indefinite)

Billing cycles​

CycleDescriptionCharge frequency
weeklyEvery 7 days52 charges/year
biweeklyEvery 14 days26 charges/year
monthlySame day each month12 charges/year
quarterlyEvery 3 months4 charges/year
semiannuallyEvery 6 months2 charges/year
yearlyOnce per year1 charge/year

Response fields​

All Create charge response fields, plus:

FieldTypeDescription
subscription.subscription_uuidstringUnique subscription identifier
subscription.cyclestringBilling cycle
subscription.statusstringactive on creation
subscription.next_charge_datestringNext automatic charge date
subscription.end_datestringSubscription end date (null if indefinite)

HTTP status codes​

StatusDescription
200Subscription created and first charge processed
400Invalid subscription cycle or missing required fields
401Invalid or expired Bearer token
403Insufficient permissions for this wallet
404Wallet not found
409Duplicate (same Idempotency-Key)
422Validation error (invalid card, cycle, dates)
429Rate limit exceeded
500Internal server error — retry with exponential backoff

Code examples​

curl -s -X POST https://sandbox.api.a55.tech/api/v1/bank/wallet/charge/ \
-H "Authorization: Bearer $A55_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: aa0e8400-e29b-41d4-a716-446655440005" \
-d '{
"wallet_uuid": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"merchant_id": "11111111-1111-1111-1111-111111111111",
"payer_name": "Maria Silva",
"payer_email": "maria@example.com",
"payer_tax_id": "123.456.789-09",
"payer_cell_phone": "+5511999999999",
"installment_value": 49.90,
"installment_count": 1,
"currency": "BRL",
"due_date": "2026-12-31",
"description": "Premium Plan — Monthly subscription",
"type_charge": "credit_card",
"card_number": "4024007153763191",
"card_name": "MARIA SILVA",
"card_expiry_month": "12",
"card_expiry_year": "2030",
"card_cvv": "123",
"subscription": {
"cycle": "monthly",
"end_date": "2027-12-31"
},
"webhook_url": "https://your-app.com/webhooks/a55",
"payer_address": {
"street": "Av. Paulista",
"address_number": "1000",
"complement": "Sala 101",
"neighborhood": "Bela Vista",
"city": "São Paulo",
"state": "SP",
"postal_code": "01310-100",
"country": "BR"
}
}'

Error response example​

{
"charge_uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"status": "error",
"message": [
{
"code": "INVALID_SUBSCRIPTION_CYCLE",
"source": "subscription",
"description": "Cycle 'daily' is not supported. Use: weekly, biweekly, monthly, quarterly, semiannually, yearly"
}
]
}