PaystationdocsPaystation

Cancel a subscription without a fee; a canceled one is answered as it is ​

POST /v1/subscriptions/{id}/cancel

Cancel a subscription without a fee; a canceled one is answered as it is

POST/v1/subscriptions/{id}/cancel

Autenticação

  • Chave secretask_…, só no seu servidor

Envie a chave no cabeçalho Authorization: Bearer <chave>.

Parâmetros

  • idstring · pathobrigatório

    `sub_<uuid>`.

Resposta

200OK

  • idstringobrigatório

    `sub_` + the id of the charge that opened it.

  • objectstringobrigatório

    Valores: subscription

  • statusstringobrigatório

    Valores: pendingprocessingactivepast_duecanceledfinished

  • chargestring (uuid)obrigatório

    The charge that opened it, readable at `GET /v1/charges/{id}`.

  • payment_methodstringpode ser nullobrigatório

    Valores: cardpixboleto

  • amountintegerpode ser nullobrigatório

    Integer cents of the next charge, net of any discount; only while `active`.

  • interval_daysintegerpode ser nullobrigatório
  • current_period_endstringpode ser nullobrigatório

    Due date of the next charge; only while `active`.

  • canceled_atstringpode ser nullobrigatório

    ISO 8601, UTC.

Erros

400The request path could not be decoded (`malformed_path`).
401Missing or invalid key, or a public key (`secret_key_required`).
404Not found, not yours, declined, or not a well-formed id (`subscription_not_found`).
409It cannot be canceled (`subscription_not_cancelable`), or a cancellation fee is being charged (`cancellation_pending`).
422A body was sent (`unknown_parameter`).
429Rate limited.
500Unexpected error, or `api_unavailable`.
503The subscription could not be reached right now (`api_unavailable`); retry.

Todo erro vem no mesmo envelope: error.type, error.code, error.message e error.request_id, também devolvido no cabeçalho X-Request-Id.