v1

latestOpenAPI 3.1.02026-07-228956435.8 KB
Charges

Cancel a charge

Cancels a charge. Only charges with status pending can be canceled. Once the collection starts, the charge can no longer be canceled.

post/charges/{id}/cancel

Path parameters

idstring required

The id of the charge to cancel. Only pending charges can be canceled.

Response

The canceled charge, with status canceled.

idstring required

Unique identifier of the charge.

object'charge' required

Type of the object. Always charge.

amountinteger required

A positive integer in the smallest unit of currency (for example, 1000 for $1000 CLP, since CLP has no minor unit).

created_atstring date-time required

ISO 8601 timestamp of when the charge was created.

currencystring required

Three-letter ISO 4217 currency code. CLP is the only supported currency.

failure_code'insufficient_funds' | 'subscription_inactive' | 'charge_amount_limit_exceeded' | 'bank_account_unavailable' | 'other' | 'null' nullable required

Reason why the charge failed. Always null unless status is failed. One of insufficient_funds (the bank account did not have enough funds), subscription_inactive (the subscription is no longer active at the bank), charge_amount_limit_exceeded (the amount exceeds the bank's per-charge limit), bank_account_unavailable (the bank account is closed, blocked, or could not be found), or other.

metadataobject required

Set of key-value pairs attached to the charge when it was created.

mode'test' | 'live' required

Mode of the object. live objects use real institution data, test objects use fake data for integration testing.

status'pending' | 'in_progress' | 'succeeded' | 'failed' | 'canceled' required

Current state of the charge. One of pending (not yet sent to the bank), in_progress (being processed by the bank), succeeded, failed, or canceled.

subscription_idstring required

Identifier of the subscription the charge belongs to.

Example response

{
  "id": "ch_o9YDuRzUez2GqV4x",
  "amount": 5000,
  "created_at": "2021-05-17T17:04:10.284Z",
  "currency": "CLP",
  "failure_code": "insufficient_funds",
  "metadata": {
    "order_id": "9182"
  },
  "mode": "live",
  "recipient_account": {
    "holder_id": "111111111",
    "institution_id": "cl_banco_estado",
    "number": "987654321",
    "type": "checking_account"
  },
  "status": "succeeded",
  "subscription_id": "sub_nMNejK7BT8oGbvO4"
}
All 89 operations