Assinaturas
Atualizar Assinatura (Item)
PATCH
/v1/subscriptions/:subscriptionIdBase URL Produção:
https://api.validapay.com.brBase URL Sandbox:
https://sandbox.validapay.com.brAutenticação
bearerAuthorizationstring · header · obrigatório
Envie no header:
Authorization: Bearer {{token}}Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| subscriptionId | string | Required | Subscriptionid |
Altera informações de um item dentro de uma assinatura ativa.
Atualizar assinatura — upgrade/downgrade de item
Ver descrição do request de cancelamento para a tabela de campos.
Body
application/json
Content-Type:application/json
{
"old": {
"itemId": "item_xxx"
},
"new": {
"priceId": "price_yyy",
"quantity": 2
}
}Schema
| Field | Type | Required | Description |
|---|---|---|---|
old | object | - | - |
new | object | - | - |
Headers
| Name | Type | Value | Required |
|---|---|---|---|
| Content-Type | - | application/json | Optional |
const url = 'https://sandbox.validapay.com.br/v1/subscriptions/:subscriptionId';
const options = {
method: 'PATCH',
headers: {
'Authorization': 'Bearer {{token}}',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"old": {
"itemId": "item_xxx"
},
"new": {
"priceId": "price_yyy",
"quantity": 2
}
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Response Examples
200200
{
"success": true,
"type": "UPGRADE",
"chargeId": "cha_xxx",
"prorataAmount": 45.0
}