Subscriptions - Create
Cria uma nova assinatura com plano, cliente e itens conforme o contrato de criação.
Cria uma nova assinatura com plano, cliente e itens conforme o contrato de criação.
Authorization
SelectKeyAuth API key for all authenticated requests. Send your key in the selectkey header (e.g. sandbox sl_test_…, production sl_live_…).
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/v1/subscriptions" \ -H "Content-Type: application/json" \ -d '{ "callback": { "webhookUrl": "https://api.example.com/webhooks/subscription" }, "payment": { "method": "pix", "currency": "BRL" }, "geolocation": { "ipAddress": "189.44.12.1", "latitude": -23.55, "longitude": -46.63, "deviceFingerprint": "fp_5f9c2a7b3e4d8b1a" }, "shipping": { "address": { "id": "addr_abc123", "street": "Av. Paulista", "number": "1000", "complement": "Apt 42", "district": "Centro", "city": "São Paulo", "state": "SP", "country": "BR", "postcode": "01310-100" }, "customerCost": "1500", "internalCost": "1200", "description": "Caixa especial", "recipientName": "Maria Souza", "recipientDocument": "12345678901", "recipientDocumentType": "cpf", "recipientPhone": "5511999999999", "trackingSiteUrl": "https://correios.com.br", "trackingCode": "BR123456789BR", "deliveryStatus": "in_transit", "deliveryDate": "2026-06-15", "deliveryTimeWindow24h": "9h/18h", "packageWeight": "1.2kg", "packageDimensions": "30x20x10cm", "instructions": "Tocar interfone", "geolocationLatitude": -23.55, "geolocationLongitude": -46.63, "insurance": false, "method": "pac" }, "discount": { "type": "flat", "value": 500, "id": "dis_abc123" }, "customer": { "document": { "type": "cpf", "number": "12345678901" }, "telephone": { "countryCode": "55", "areaCode": "11", "number": "999999999" }, "firstName": "João", "lastName": "Silva", "email": "[email protected]", "externalReference": "CRM-USER-001", "gender": "male", "birthdate": "1990-01-15", "additionalEmails": [ "[email protected]" ], "metadata": { "crmId": "lead-42" } }, "billing": { "address": { "street": "Av. Paulista", "number": "1000", "complement": "Apt 42", "district": "Bela Vista", "city": "São Paulo", "state": "SP", "country": "BR", "postcode": "01310-100" } }, "items": [ { "id": "var_abc123", "pricing": { "quantity": 1 }, "enabled": true } ], "description": "Plano Premium — assinatura mensal", "externalReference": "SUB-1001", "metadata": { "source": "checkout", "campaign": "spring" }, "tags": [ "recorrente", "vip" ], "splits": [ { "recipient": "acc_abc", "type": "percentage", "value": 10 } ], "sessionId": "ses_abc123", "integrationId": "app_abc123", "discounts": [ { "id": "dis_abc123" } ] }'{
"id": "subs_01hqzvabc",
"status": "active",
"currency": "BRL",
"method": "credit",
"type": "prepaid",
"currentCycle": {
"id": "cyc_01hqzvabc",
"cycle": 3,
"status": "billed",
"startDate": "2026-04-01T00:00:00.000Z",
"endDate": "2026-04-30T23:59:59.000Z",
"dueDate": "2026-04-01T00:00:00.000Z",
"billedAt": "2026-04-12T17:56:33.000Z",
"updatedAt": "2026-04-12T17:56:33.000Z",
"createdAt": "2026-04-01T00:00:00.000Z"
},
"currentCharge": {
"error": null,
"id": "tra_01hqzvabc",
"customId": null,
"amount": 9900,
"originalAmount": 9900,
"status": "paid",
"method": "credit",
"currency": "BRL",
"payment": {
"provider": "selectwin",
"version": "1.1",
"refused": null,
"reusable": false,
"billetUrl": null,
"billetBarcode": null,
"billetSequence": null,
"billetDocumentNumber": null,
"billetReferenceNumber": null,
"pixQrCodeEmv": null,
"pixQrCodeUrl": null,
"pixQrCodeImage": null,
"acquirerTransactionNumber": "A1B2C3D4E5",
"cardFirstDigits": "411111",
"cardLastDigits": "1111",
"cardBrand": "visa",
"cardRegistered": true,
"installments": 1,
"expirationDate": null,
"paidAt": "2026-04-12T17:56:33.000Z",
"allowRenewPayment": false,
"invoiceLink": "https://selectwin.io/invoices/tra_01hqzvabc"
},
"externalReference": null,
"spplited": false,
"timeline": [
{
"id": "tml_01hqzvabc",
"message": "Transaction created",
"details": null,
"type": "status",
"updatedAt": "2026-04-12T17:56:33.000Z",
"createdAt": "2026-04-12T17:56:33.000Z"
}
],
"updatedAt": "2026-04-12T17:56:33.000Z",
"createdAt": "2026-04-12T17:56:33.000Z"
},
"customer": {
"id": "cus_01hqzvabc",
"firstName": "João",
"lastName": "Silva",
"email": "[email protected]",
"birthdate": "1990-01-15",
"gender": "male",
"document": {
"type": "cpf",
"number": "12345678901"
},
"telephone": {
"countryCode": "55",
"areaCode": "11",
"number": "999999999",
"line": "5511999999999"
},
"available": true,
"delinquent": false,
"externalReference": "CRM-USER-001",
"additionalEmails": [
"[email protected]"
],
"metadata": {
"crmId": "lead-42"
},
"updatedAt": "2026-04-12T17:56:33.000Z",
"createdAt": "2026-04-10T09:15:25.000Z"
},
"billing": {
"frequency": "monthly",
"frequencyCount": 1,
"endDate": null,
"exactDay": null,
"freeTrialDays": 0,
"address": {
"street": "Av. Paulista",
"number": "1000",
"complement": "Apt 42",
"district": "Bela Vista",
"city": "São Paulo",
"state": "SP",
"country": "BR",
"postcode": "01310-100",
"line": "Av. Paulista, 1000",
"fingerprint": null,
"line1": "Av. Paulista",
"line2": "1000",
"line3": "Apt 42"
}
},
"discount": {
"value": 500,
"type": "flat",
"percentageOfAmount": null
},
"shippable": false,
"shipping": null,
"spplited": true,
"splits": [
{
"id": "split_01hqzvabc",
"recipient": "bus_9876543210",
"type": "percentage",
"value": 10,
"chargeProcessingFee": false,
"liable": true,
"updatedAt": "2026-04-12T17:56:33.000Z",
"createdAt": "2026-04-12T17:56:33.000Z"
}
],
"items": [
{
"id": "item_01hqzvabc",
"quantity": 1,
"unitPrice": 9900,
"pricingSchema": "unit",
"name": "Premium Plan",
"description": "Plano Premium mensal",
"enabled": true,
"currency": "BRL",
"metadata": null,
"images": [
"https://cdn.example.com/product.png"
],
"externalReference": null,
"updatedAt": "2026-04-12T17:56:33.000Z",
"createdAt": "2026-04-12T17:56:33.000Z"
}
],
"callback": {
"webhookUrl": "https://api.example.com/webhooks/subscription",
"active": true
},
"externalReference": "SUB-1001",
"metadata": {
"source": "checkout",
"campaign": "spring"
},
"updatedAt": "2026-04-12T17:56:33.000Z",
"createdAt": "2026-04-12T17:56:33.000Z",
"merchant": {
"name": "Seller Name",
"merchantId": "bus_1234567890",
"isSubAccount": false
},
"_links": {
"self": {
"href": "https://api.selectwin.io/v1/subscriptions/subs_01hqzvabc",
"method": "POST",
"description": "Create a new subscription."
},
"read": {
"href": "https://api.selectwin.io/v1/subscriptions/subs_01hqzvabc",
"method": "GET",
"description": "Read a subscription."
},
"cancel": {
"href": "https://api.selectwin.io/v1/subscriptions/subs_01hqzvabc",
"method": "DELETE",
"description": "Cancel the subscription."
},
"list": {
"href": "https://api.selectwin.io/v1/subscriptions",
"method": "GET",
"description": "List all subscriptions."
}
}
}{
"error": {
"status": "Bad Request",
"statusCode": 400,
"category": "validation",
"message": "Validation errors occurred",
"details": "One or more parameters are invalid or out of range. Please check the parameters and try again.",
"params": [
{
"payment[currency]": "currency must be one of [BRL]"
},
{
"amount": "amount is required"
}
],
"code": "invalidParameters",
"resource": "client"
}
}{
"error": {
"status": "Unauthorized",
"statusCode": 401,
"category": "authentication",
"message": "Unauthorized",
"details": "Authentication failed. The provided API key is invalid or does not have permission to operate.",
"code": "unauthorized"
}
}{
"error": {
"status": "Request Failed",
"statusCode": 402,
"category": "payment",
"code": "insufficientFundsError",
"type": "cardError",
"message": "The request was valid, but the payment process failed.",
"details": "Please verify your payment information and try again.",
"params": [
{
"payment": "Saldo insuficiente para realizar esta compra. Verifique seu limite disponível."
}
],
"displayMessage": "Saldo insuficiente para realizar esta compra. Verifique seu limite disponível.",
"reversible": false
}
}{
"error": {
"status": "Forbidden",
"statusCode": 403,
"category": "authorization",
"message": "Forbidden",
"details": "Access denied. This may be due to IP blocks, domain restrictions, or insufficient permissions.",
"code": "forbidden"
}
}{
"error": {
"status": "Not Found",
"statusCode": 404,
"category": "client",
"message": "Not Found",
"details": "The requested resource was not found on the server.",
"code": "notFound"
}
}{
"error": {
"status": "Unprocessable Entity",
"statusCode": 422,
"category": "validation",
"message": "Unprocessable Entity",
"details": "The request was understood, but contains invalid data that could not be processed.",
"code": "unprocessableEntity"
}
}{
"error": {
"status": "Too Many Requests",
"statusCode": 429,
"category": "rate_limit",
"message": "Too Many Requests",
"details": "The number of requests exceeded the limit allowed for the IP or user.",
"retryAfterMinutes": 60,
"code": "tooManyRequests"
}
}{
"error": {
"status": "Internal Server Error",
"statusCode": 500,
"category": "server",
"message": "Server error.",
"details": "An internal server error occurred. Please try again later.",
"code": "serverError",
"resource": "server"
}
}