curl --request PUT \
--url https://api.malga.io/v1/subscriptions/{id} \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--header 'X-Client-Id: <api-key>' \
--data '
{
"name": "<string>",
"merchantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"referenceKey": "<string>",
"items": [
{
"name": "<string>",
"amount": 2,
"quantity": 2,
"description": "<string>",
"sku": "<string>",
"categoryId": "<string>",
"locality": "<string>",
"date": "2023-12-25",
"type": 123,
"genre": "<string>",
"tickets": {
"quantityTicketSale": 123,
"quantityEventHouse": 123,
"convenienceFeeValue": 123,
"quantityFull": 123,
"quantityHalf": 123,
"batch": 123
},
"location": {
"street": "<string>",
"number": "<string>",
"complement": "<string>",
"zipCode": "<string>",
"city": "<string>",
"state": "<string>",
"country": "<string>",
"district": "<string>",
"reference": "<string>"
}
}
],
"recurrence": {
"cycles": 2,
"startAt": "<string>"
},
"splitRules": [
{
"sellerId": "5323ece6-816d-11ed-a1eb-0242ac120002",
"percentage": 70,
"amount": 5000,
"processingFee": false,
"chargeEntireFee": false,
"chargeRemainderFee": false,
"liable": true,
"transactionOwner": true,
"fares": {
"mdr": 2.5,
"fee": 0.3
}
}
],
"cancelAtPeriodEnd": true,
"scheduledCancellationAt": "2025-12-31",
"scheduledCancellationReason": "Cliente solicitou cancelamento"
}
'const options = {
method: 'PUT',
headers: {
'X-Client-Id': '<api-key>',
'X-Api-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
merchantId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
referenceKey: '<string>',
items: [
{
name: '<string>',
amount: 2,
quantity: 2,
description: '<string>',
sku: '<string>',
categoryId: '<string>',
locality: '<string>',
date: '2023-12-25',
type: 123,
genre: '<string>',
tickets: {
quantityTicketSale: 123,
quantityEventHouse: 123,
convenienceFeeValue: 123,
quantityFull: 123,
quantityHalf: 123,
batch: 123
},
location: {
street: '<string>',
number: '<string>',
complement: '<string>',
zipCode: '<string>',
city: '<string>',
state: '<string>',
country: '<string>',
district: '<string>',
reference: '<string>'
}
}
],
recurrence: {cycles: 2, startAt: '<string>'},
splitRules: [
{
sellerId: '5323ece6-816d-11ed-a1eb-0242ac120002',
percentage: 70,
amount: 5000,
processingFee: false,
chargeEntireFee: false,
chargeRemainderFee: false,
liable: true,
transactionOwner: true,
fares: {mdr: 2.5, fee: 0.3}
}
],
cancelAtPeriodEnd: true,
scheduledCancellationAt: '2025-12-31',
scheduledCancellationReason: 'Cliente solicitou cancelamento'
})
};
fetch('https://api.malga.io/v1/subscriptions/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.malga.io/v1/subscriptions/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"merchantId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"referenceKey\": \"<string>\",\n \"items\": [\n {\n \"name\": \"<string>\",\n \"amount\": 2,\n \"quantity\": 2,\n \"description\": \"<string>\",\n \"sku\": \"<string>\",\n \"categoryId\": \"<string>\",\n \"locality\": \"<string>\",\n \"date\": \"2023-12-25\",\n \"type\": 123,\n \"genre\": \"<string>\",\n \"tickets\": {\n \"quantityTicketSale\": 123,\n \"quantityEventHouse\": 123,\n \"convenienceFeeValue\": 123,\n \"quantityFull\": 123,\n \"quantityHalf\": 123,\n \"batch\": 123\n },\n \"location\": {\n \"street\": \"<string>\",\n \"number\": \"<string>\",\n \"complement\": \"<string>\",\n \"zipCode\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"country\": \"<string>\",\n \"district\": \"<string>\",\n \"reference\": \"<string>\"\n }\n }\n ],\n \"recurrence\": {\n \"cycles\": 2,\n \"startAt\": \"<string>\"\n },\n \"splitRules\": [\n {\n \"sellerId\": \"5323ece6-816d-11ed-a1eb-0242ac120002\",\n \"percentage\": 70,\n \"amount\": 5000,\n \"processingFee\": false,\n \"chargeEntireFee\": false,\n \"chargeRemainderFee\": false,\n \"liable\": true,\n \"transactionOwner\": true,\n \"fares\": {\n \"mdr\": 2.5,\n \"fee\": 0.3\n }\n }\n ],\n \"cancelAtPeriodEnd\": true,\n \"scheduledCancellationAt\": \"2025-12-31\",\n \"scheduledCancellationReason\": \"Cliente solicitou cancelamento\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-Client-Id", "<api-key>")
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "019860b2-feb8-7edf-b5ba-0c48a7a8bd3f",
"name": "Assinatura Premium com Eventos",
"clientId": "e234eeb3-483d-4df2-87eb-1e2be5cdaccd",
"merchantId": "225d39bc-1fbb-480a-90bd-f0caad05d2d0",
"customerId": "2a8b64ce-904c-4256-b79a-49525808609c",
"referenceKey": "SUB-PREMIUM-001",
"currency": "BRL",
"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",
"quantityHalf": 0,
"batch": 1
}
}
],
"recurrence": {
"interval": "monthly",
"cycles": 12,
"startAt": "2025-08-10",
"endAt": "2026-08-10",
"nextDueDate": "2025-07-30"
},
"paymentMethod": {
"type": "credit",
"card": {
"cardId": "ebef4e7e-b5d3-49d8-ac8f-b973faaa3ac5"
},
"installments": 1
},
"trial": {
"endAt": "2025-08-15"
},
"splitRules": [
{
"sellerId": "5323ece6-816d-11ed-a1eb-0242ac120002",
"percentage": 70,
"amount": 5000,
"processingFee": false,
"chargeEntireFee": false,
"chargeRemainderFee": false,
"liable": true,
"transactionOwner": true,
"fares": {
"mdr": 2.5,
"fee": 0.3
}
}
],
"status": "created",
"amount": 29900,
"liveMode": true,
"lastCycle": {
"id": "01985cf8-9877-7c09-bbf6-2cceb3384a61",
"customerId": "2a8b64ce-904c-4256-b79a-49525808609c",
"merchantId": "225d39bc-1fbb-480a-90bd-f0caad05d2d0",
"cycle": 1,
"status": "authorized",
"createdAt": "2025-07-30T20:14:12.599715Z",
"paymentHistory": [
{
"id": "84ec50c5-1fb4-4d6b-bbff-fedc47ba9fa3",
"createdAt": "2025-07-30T20:14:12.608115Z",
"chargeId": "6f2a0713-c4cd-4e2d-8603-69855902676d",
"status": "authorized"
}
]
},
"createdAt": "2025-07-31T13:36:40.118822Z",
"updatedAt": "2025-07-31T13:36:40.118822Z",
"cancelAtPeriodEnd": true,
"scheduledCancellationAt": "2025-12-31",
"scheduledCancellationReason": "Cliente solicitou cancelamento"
}Atualizar assinatura
curl --request PUT \
--url https://api.malga.io/v1/subscriptions/{id} \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--header 'X-Client-Id: <api-key>' \
--data '
{
"name": "<string>",
"merchantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"referenceKey": "<string>",
"items": [
{
"name": "<string>",
"amount": 2,
"quantity": 2,
"description": "<string>",
"sku": "<string>",
"categoryId": "<string>",
"locality": "<string>",
"date": "2023-12-25",
"type": 123,
"genre": "<string>",
"tickets": {
"quantityTicketSale": 123,
"quantityEventHouse": 123,
"convenienceFeeValue": 123,
"quantityFull": 123,
"quantityHalf": 123,
"batch": 123
},
"location": {
"street": "<string>",
"number": "<string>",
"complement": "<string>",
"zipCode": "<string>",
"city": "<string>",
"state": "<string>",
"country": "<string>",
"district": "<string>",
"reference": "<string>"
}
}
],
"recurrence": {
"cycles": 2,
"startAt": "<string>"
},
"splitRules": [
{
"sellerId": "5323ece6-816d-11ed-a1eb-0242ac120002",
"percentage": 70,
"amount": 5000,
"processingFee": false,
"chargeEntireFee": false,
"chargeRemainderFee": false,
"liable": true,
"transactionOwner": true,
"fares": {
"mdr": 2.5,
"fee": 0.3
}
}
],
"cancelAtPeriodEnd": true,
"scheduledCancellationAt": "2025-12-31",
"scheduledCancellationReason": "Cliente solicitou cancelamento"
}
'const options = {
method: 'PUT',
headers: {
'X-Client-Id': '<api-key>',
'X-Api-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
merchantId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
referenceKey: '<string>',
items: [
{
name: '<string>',
amount: 2,
quantity: 2,
description: '<string>',
sku: '<string>',
categoryId: '<string>',
locality: '<string>',
date: '2023-12-25',
type: 123,
genre: '<string>',
tickets: {
quantityTicketSale: 123,
quantityEventHouse: 123,
convenienceFeeValue: 123,
quantityFull: 123,
quantityHalf: 123,
batch: 123
},
location: {
street: '<string>',
number: '<string>',
complement: '<string>',
zipCode: '<string>',
city: '<string>',
state: '<string>',
country: '<string>',
district: '<string>',
reference: '<string>'
}
}
],
recurrence: {cycles: 2, startAt: '<string>'},
splitRules: [
{
sellerId: '5323ece6-816d-11ed-a1eb-0242ac120002',
percentage: 70,
amount: 5000,
processingFee: false,
chargeEntireFee: false,
chargeRemainderFee: false,
liable: true,
transactionOwner: true,
fares: {mdr: 2.5, fee: 0.3}
}
],
cancelAtPeriodEnd: true,
scheduledCancellationAt: '2025-12-31',
scheduledCancellationReason: 'Cliente solicitou cancelamento'
})
};
fetch('https://api.malga.io/v1/subscriptions/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.malga.io/v1/subscriptions/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"merchantId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"referenceKey\": \"<string>\",\n \"items\": [\n {\n \"name\": \"<string>\",\n \"amount\": 2,\n \"quantity\": 2,\n \"description\": \"<string>\",\n \"sku\": \"<string>\",\n \"categoryId\": \"<string>\",\n \"locality\": \"<string>\",\n \"date\": \"2023-12-25\",\n \"type\": 123,\n \"genre\": \"<string>\",\n \"tickets\": {\n \"quantityTicketSale\": 123,\n \"quantityEventHouse\": 123,\n \"convenienceFeeValue\": 123,\n \"quantityFull\": 123,\n \"quantityHalf\": 123,\n \"batch\": 123\n },\n \"location\": {\n \"street\": \"<string>\",\n \"number\": \"<string>\",\n \"complement\": \"<string>\",\n \"zipCode\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"country\": \"<string>\",\n \"district\": \"<string>\",\n \"reference\": \"<string>\"\n }\n }\n ],\n \"recurrence\": {\n \"cycles\": 2,\n \"startAt\": \"<string>\"\n },\n \"splitRules\": [\n {\n \"sellerId\": \"5323ece6-816d-11ed-a1eb-0242ac120002\",\n \"percentage\": 70,\n \"amount\": 5000,\n \"processingFee\": false,\n \"chargeEntireFee\": false,\n \"chargeRemainderFee\": false,\n \"liable\": true,\n \"transactionOwner\": true,\n \"fares\": {\n \"mdr\": 2.5,\n \"fee\": 0.3\n }\n }\n ],\n \"cancelAtPeriodEnd\": true,\n \"scheduledCancellationAt\": \"2025-12-31\",\n \"scheduledCancellationReason\": \"Cliente solicitou cancelamento\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-Client-Id", "<api-key>")
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "019860b2-feb8-7edf-b5ba-0c48a7a8bd3f",
"name": "Assinatura Premium com Eventos",
"clientId": "e234eeb3-483d-4df2-87eb-1e2be5cdaccd",
"merchantId": "225d39bc-1fbb-480a-90bd-f0caad05d2d0",
"customerId": "2a8b64ce-904c-4256-b79a-49525808609c",
"referenceKey": "SUB-PREMIUM-001",
"currency": "BRL",
"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",
"quantityHalf": 0,
"batch": 1
}
}
],
"recurrence": {
"interval": "monthly",
"cycles": 12,
"startAt": "2025-08-10",
"endAt": "2026-08-10",
"nextDueDate": "2025-07-30"
},
"paymentMethod": {
"type": "credit",
"card": {
"cardId": "ebef4e7e-b5d3-49d8-ac8f-b973faaa3ac5"
},
"installments": 1
},
"trial": {
"endAt": "2025-08-15"
},
"splitRules": [
{
"sellerId": "5323ece6-816d-11ed-a1eb-0242ac120002",
"percentage": 70,
"amount": 5000,
"processingFee": false,
"chargeEntireFee": false,
"chargeRemainderFee": false,
"liable": true,
"transactionOwner": true,
"fares": {
"mdr": 2.5,
"fee": 0.3
}
}
],
"status": "created",
"amount": 29900,
"liveMode": true,
"lastCycle": {
"id": "01985cf8-9877-7c09-bbf6-2cceb3384a61",
"customerId": "2a8b64ce-904c-4256-b79a-49525808609c",
"merchantId": "225d39bc-1fbb-480a-90bd-f0caad05d2d0",
"cycle": 1,
"status": "authorized",
"createdAt": "2025-07-30T20:14:12.599715Z",
"paymentHistory": [
{
"id": "84ec50c5-1fb4-4d6b-bbff-fedc47ba9fa3",
"createdAt": "2025-07-30T20:14:12.608115Z",
"chargeId": "6f2a0713-c4cd-4e2d-8603-69855902676d",
"status": "authorized"
}
]
},
"createdAt": "2025-07-31T13:36:40.118822Z",
"updatedAt": "2025-07-31T13:36:40.118822Z",
"cancelAtPeriodEnd": true,
"scheduledCancellationAt": "2025-12-31",
"scheduledCancellationReason": "Cliente solicitou cancelamento"
}Path Parameters
Id da assinatura que deseja atualizar
Body
Nome da assinatura
1 - 100Identificador do merchant
Chave de referência da assinatura
Lista de itens da assinatura
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Regras de divisão de valores entre recebedores (opcional)
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Indica se a assinatura está agendada para cancelamento ao final do período atual
true
Data agendada para o cancelamento (formato YYYY-MM-DD). Quando definida, tem prioridade sobre trialEnd e nextDueDate para determinar a data efetiva de cancelamento
"2025-12-31"
Motivo do cancelamento agendado (opcional)
"Cliente solicitou cancelamento"
Response
Success
Identificador da assinatura
"019860b2-feb8-7edf-b5ba-0c48a7a8bd3f"
Nome da assinatura
"Assinatura Premium com Eventos"
Identificador do client
"e234eeb3-483d-4df2-87eb-1e2be5cdaccd"
Identificador do merchant
"225d39bc-1fbb-480a-90bd-f0caad05d2d0"
Identificador do cliente
"2a8b64ce-904c-4256-b79a-49525808609c"
Chave de referência da assinatura
"SUB-PREMIUM-001"
Moeda da assinatura
"BRL"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Informações do período de trial (se aplicável)
Show child attributes
Show child attributes
Regras de divisão de valores entre recebedores
Show child attributes
Show child attributes
Status da assinatura
created, active, paused, canceled, unpaid, expired, trialing "created"
29900
Indica se a assinatura está em modo de produção
true
Último cycle da assinatura. Sempre presente nas respostas individuais (GET, CREATE, UPDATE), pode ser null se não houver cycles.
Show child attributes
Show child attributes
"2025-07-31T13:36:40.118822Z"
"2025-07-31T13:36:40.118822Z"
Indica se a assinatura está agendada para cancelamento ao final do período atual
true
Data agendada para o cancelamento (formato YYYY-MM-DD). Quando definida, tem prioridade sobre trialEnd e nextDueDate para determinar a data efetiva de cancelamento
"2025-12-31"
Motivo do cancelamento agendado (opcional)
"Cliente solicitou cancelamento"
Related topics
Cobrança instantâneaCancelamento AgendadoWebhooks v1.1Atualizar configurações do clienteWas this page helpful?