cURL
curl --request GET \
--url https://api.cakto.com.br/public_api/subscriptions/{id}/billing-cycles/{cycle_id}/attempts/ \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.cakto.com.br/public_api/subscriptions/{id}/billing-cycles/{cycle_id}/attempts/"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.cakto.com.br/public_api/subscriptions/{id}/billing-cycles/{cycle_id}/attempts/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cakto.com.br/public_api/subscriptions/{id}/billing-cycles/{cycle_id}/attempts/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api.cakto.com.br/public_api/subscriptions/{id}/billing-cycles/{cycle_id}/attempts/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.get("https://api.cakto.com.br/public_api/subscriptions/{id}/billing-cycles/{cycle_id}/attempts/")
.header("Authorization", "Bearer <token>")
.asString();using RestSharp;
var options = new RestClientOptions("https://api.cakto.com.br/public_api/subscriptions/{id}/billing-cycles/{cycle_id}/attempts/");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
var response = await client.GetAsync(request);
Console.WriteLine("{0}", response.Content);
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": "d9abeb29-6c7d-46fa-938a-4fbce40be05d",
"attempt_number": 1,
"amount": "100.00",
"result": "failure",
"failure_reason": "Insufficient funds",
"scheduled_for": "2026-05-18T19:14:17.677041Z",
"started_at": "2026-05-18T19:14:18.123456Z",
"completed_at": "2026-05-18T19:14:20.789012Z",
"created_at": "2026-05-18T19:14:17.677041Z"
},
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"attempt_number": 2,
"amount": "100.00",
"result": "success",
"failure_reason": null,
"scheduled_for": "2026-05-19T19:14:17.677041Z",
"started_at": "2026-05-19T19:14:18.000000Z",
"completed_at": "2026-05-19T19:14:22.000000Z",
"created_at": "2026-05-18T19:14:17.677041Z"
}
]
}{
"detail": "As credenciais de autenticação não foram fornecidas."
}{
"detail": "Não encontrado."
}Ciclos de Assinaturas
Listar Tentativas de Cobrança
Analise as tentativas de cobrança de um ciclo específico. Entenda por que um pagamento falhou e quando cada tentativa ocorreu.
GET
/
public_api
/
subscriptions
/
{id}
/
billing-cycles
/
{cycle_id}
/
attempts
/
cURL
curl --request GET \
--url https://api.cakto.com.br/public_api/subscriptions/{id}/billing-cycles/{cycle_id}/attempts/ \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.cakto.com.br/public_api/subscriptions/{id}/billing-cycles/{cycle_id}/attempts/"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.cakto.com.br/public_api/subscriptions/{id}/billing-cycles/{cycle_id}/attempts/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cakto.com.br/public_api/subscriptions/{id}/billing-cycles/{cycle_id}/attempts/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api.cakto.com.br/public_api/subscriptions/{id}/billing-cycles/{cycle_id}/attempts/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.get("https://api.cakto.com.br/public_api/subscriptions/{id}/billing-cycles/{cycle_id}/attempts/")
.header("Authorization", "Bearer <token>")
.asString();using RestSharp;
var options = new RestClientOptions("https://api.cakto.com.br/public_api/subscriptions/{id}/billing-cycles/{cycle_id}/attempts/");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
var response = await client.GetAsync(request);
Console.WriteLine("{0}", response.Content);
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": "d9abeb29-6c7d-46fa-938a-4fbce40be05d",
"attempt_number": 1,
"amount": "100.00",
"result": "failure",
"failure_reason": "Insufficient funds",
"scheduled_for": "2026-05-18T19:14:17.677041Z",
"started_at": "2026-05-18T19:14:18.123456Z",
"completed_at": "2026-05-18T19:14:20.789012Z",
"created_at": "2026-05-18T19:14:17.677041Z"
},
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"attempt_number": 2,
"amount": "100.00",
"result": "success",
"failure_reason": null,
"scheduled_for": "2026-05-19T19:14:17.677041Z",
"started_at": "2026-05-19T19:14:18.000000Z",
"completed_at": "2026-05-19T19:14:22.000000Z",
"created_at": "2026-05-18T19:14:17.677041Z"
}
]
}{
"detail": "As credenciais de autenticação não foram fornecidas."
}{
"detail": "Não encontrado."
}Escopo
read subscriptions
Quando usar
- Para entender por que uma cobrança específica falhou
- Para verificar se o gateway está tentando cobrar novamente
- Para decidir se é hora de entrar em contato com o cliente
Como interpretar as tentativas
As tentativas são retornadas ordenadas pelo número da tentativa:| Campo | Descrição | Como usar |
|---|---|---|
attempt_number | Sequência da tentativa | Veja quantas vezes o sistema já tentou cobrar |
result | success ou failure | Identifique se alguma tentativa foi bem-sucedida |
failure_reason | Motivo da recusa | Use para entender o problema (ex: fundos insuficientes) |
scheduled_for | Data agendada | Veja quando a próxima tentativa estava prevista |
started_at / completed_at | Início e fim | Meça o tempo de processamento de cada tentativa |
Múltiplas falhas seguidas com o mesmo
failure_reason indicam um problema persistente no método de pagamento. Considere notificar o cliente antes do cancelamento automático.Cada tentativa representa uma chamada real ao gateway de pagamento. Use este endpoint para auditar a integridade do processo de cobrança recorrente.
Authorizations
Token de autenticação do tipo Bearer {access_token}, onde {access_token} é o token obtido no fluxo de autenticação.
Was this page helpful?