curl --request GET \
--url https://api.malga.io/v1/subscriptions/{id}/cycles/{cycleId} \
--header 'X-Api-Key: <api-key>' \
--header 'X-Client-Id: <api-key>'const options = {method: 'GET', headers: {'X-Client-Id': '<api-key>', 'X-Api-Key': '<api-key>'}};
fetch('https://api.malga.io/v1/subscriptions/{id}/cycles/{cycleId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.malga.io/v1/subscriptions/{id}/cycles/{cycleId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Client-Id", "<api-key>")
req.Header.Add("X-Api-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "01985cf8-9877-7c09-bbf6-2cceb3384a61",
"customerId": "2a8b64ce-904c-4256-b79a-49525808609c",
"merchantId": "225d39bc-1fbb-480a-90bd-f0caad05d2d0",
"cycle": 1,
"attempts": 1,
"status": "authorized",
"amount": 29900,
"items": [
{
"name": "Ingresso VIP Mensal",
"amount": 29900,
"quantity": 1,
"description": "Acesso VIP premium a eventos mensais",
"sku": "VIP-EVENT-001",
"risk": "Low",
"categoryId": "entertainment",
"locality": "São Paulo",
"date": "2025-12-01",
"type": 1,
"genre": "Shows e Eventos",
"tickets": {
"quantityTicketSale": 1,
"quantityEventHouse": 0,
"convenienceFeeValue": 15.5,
"quantityFull": 1,
"quantityHalf": 0,
"batch": 1
},
"location": {
"street": "Av. Paulista",
"number": "1000",
"complement": "Centro de Convenções",
"zipCode": "01310-100",
"city": "São Paulo",
"state": "SP",
"country": "Brasil",
"district": "Bela Vista",
"reference": "Próximo ao MASP"
}
}
],
"scheduledAt": "2025-07-30",
"executedAt": "2025-07-30",
"nextAttemptAt": "2025-07-31",
"isEmulated": false,
"emulatedAt": "2023-11-07T05:31:56Z",
"createdAt": "2025-07-30T20:14:12.599715Z",
"paymentHistory": [
{
"id": "84ec50c5-1fb4-4d6b-bbff-fedc47ba9fa3",
"createdAt": "2025-07-30T20:14:12.608115Z",
"executedAt": "2025-07-30T20:14:13.104331Z",
"chargeId": "6f2a0713-c4cd-4e2d-8603-69855902676d",
"attemptNumber": 1,
"status": "authorized",
"paymentMethod": {
"type": "credit",
"card": {
"cardId": "ebef4e7e-b5d3-49d8-ac8f-b973faaa3ac5"
},
"installments": 1
},
"error": {
"message": "Card declined",
"providerError": {
"declinedCode": "insufficient_funds",
"message": "<string>",
"networkDeniedMessage": "<string>",
"networkDeniedReason": "<string>",
"retryable": true
}
}
}
]
}{
"error": {
"type": "bad_request",
"code": 400,
"message": "Invalid subscription ID format",
"details": [
"One or more fields contain invalid UUID values"
]
}
}{
"error": "Authentication required",
"details": "X-Client-Id header is required"
}{
"error": {
"type": "not_found",
"code": 404,
"message": "Resource not found",
"details": [
"subscription with id 019860b2-feb8-7edf-b5ba-0c48a7a8bd3f not found"
]
}
}Recuperar detalhes de um cycle específico
Devolve o ciclo com o histórico de tentativas de cobrança (paymentHistory).
Use um cycleId da listagem de ciclos.
curl --request GET \
--url https://api.malga.io/v1/subscriptions/{id}/cycles/{cycleId} \
--header 'X-Api-Key: <api-key>' \
--header 'X-Client-Id: <api-key>'const options = {method: 'GET', headers: {'X-Client-Id': '<api-key>', 'X-Api-Key': '<api-key>'}};
fetch('https://api.malga.io/v1/subscriptions/{id}/cycles/{cycleId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.malga.io/v1/subscriptions/{id}/cycles/{cycleId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Client-Id", "<api-key>")
req.Header.Add("X-Api-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "01985cf8-9877-7c09-bbf6-2cceb3384a61",
"customerId": "2a8b64ce-904c-4256-b79a-49525808609c",
"merchantId": "225d39bc-1fbb-480a-90bd-f0caad05d2d0",
"cycle": 1,
"attempts": 1,
"status": "authorized",
"amount": 29900,
"items": [
{
"name": "Ingresso VIP Mensal",
"amount": 29900,
"quantity": 1,
"description": "Acesso VIP premium a eventos mensais",
"sku": "VIP-EVENT-001",
"risk": "Low",
"categoryId": "entertainment",
"locality": "São Paulo",
"date": "2025-12-01",
"type": 1,
"genre": "Shows e Eventos",
"tickets": {
"quantityTicketSale": 1,
"quantityEventHouse": 0,
"convenienceFeeValue": 15.5,
"quantityFull": 1,
"quantityHalf": 0,
"batch": 1
},
"location": {
"street": "Av. Paulista",
"number": "1000",
"complement": "Centro de Convenções",
"zipCode": "01310-100",
"city": "São Paulo",
"state": "SP",
"country": "Brasil",
"district": "Bela Vista",
"reference": "Próximo ao MASP"
}
}
],
"scheduledAt": "2025-07-30",
"executedAt": "2025-07-30",
"nextAttemptAt": "2025-07-31",
"isEmulated": false,
"emulatedAt": "2023-11-07T05:31:56Z",
"createdAt": "2025-07-30T20:14:12.599715Z",
"paymentHistory": [
{
"id": "84ec50c5-1fb4-4d6b-bbff-fedc47ba9fa3",
"createdAt": "2025-07-30T20:14:12.608115Z",
"executedAt": "2025-07-30T20:14:13.104331Z",
"chargeId": "6f2a0713-c4cd-4e2d-8603-69855902676d",
"attemptNumber": 1,
"status": "authorized",
"paymentMethod": {
"type": "credit",
"card": {
"cardId": "ebef4e7e-b5d3-49d8-ac8f-b973faaa3ac5"
},
"installments": 1
},
"error": {
"message": "Card declined",
"providerError": {
"declinedCode": "insufficient_funds",
"message": "<string>",
"networkDeniedMessage": "<string>",
"networkDeniedReason": "<string>",
"retryable": true
}
}
}
]
}{
"error": {
"type": "bad_request",
"code": 400,
"message": "Invalid subscription ID format",
"details": [
"One or more fields contain invalid UUID values"
]
}
}{
"error": "Authentication required",
"details": "X-Client-Id header is required"
}{
"error": {
"type": "not_found",
"code": 404,
"message": "Resource not found",
"details": [
"subscription with id 019860b2-feb8-7edf-b5ba-0c48a7a8bd3f not found"
]
}
}Response
Success
Identificador do ciclo
"01985cf8-9877-7c09-bbf6-2cceb3384a61"
Identificador do cliente
"2a8b64ce-904c-4256-b79a-49525808609c"
Identificador do merchant
"225d39bc-1fbb-480a-90bd-f0caad05d2d0"
Número do ciclo
1
Quantidade de tentativas de cobrança já feitas no ciclo. Não vem antes da primeira tentativa
1
Status do ciclo
scheduled, pending, authorized, failed, retrying, canceled "authorized"
Valor do ciclo em centavos
29900
Itens cobrados no ciclo, no formato de items da assinatura. Campos opcionais sem valor vêm como null. Só vem na consulta do ciclo, não em lastCycle
Show child attributes
Show child attributes
Data prevista da cobrança (YYYY-MM-DD, sem hora)
"2025-07-30"
Data da última tentativa de cobrança (YYYY-MM-DD, sem hora). Não vem antes da primeira tentativa
"2025-07-30"
Data da próxima retentativa (YYYY-MM-DD, sem hora). Só vem quando há retentativa agendada
"2025-07-31"
Indica se o ciclo foi gerado por emulação em testes no sandbox. Em produção é sempre false
false
Data da emulação, quando houver
Data de criação do ciclo
"2025-07-30T20:14:12.599715Z"
Tentativas de cobrança do ciclo
Show child attributes
Show child attributes
Was this page helpful?