comecerodocs

Void an order

POST
/orders/{order_id}/void

Cancels the authorization on every pending payment of the order, so the customer is never charged. The order's payment_status becomes cancelled. Only works while at least one payment is still pending (not captured); to give money back after capture, refund the order. No body is read.

Returns 201 with a payment_list holding each payment and its result. When every void fails, the API answers with an error instead and puts the payment_list in the error's meta.payment_list.

Needs a secret or trusted token that may create or update payments. A token without that permission gets 401, not 403.

Authorization

headerAuthorizationBearer <token>

A secret, trusted or limited token. See Authentication.

Path Parameters

order_id*string

The order id.

Query Parameters

expand?string

Comma-separated child objects to return in full instead of as a URL, for example customer,payments. Use dot notation for nested objects (items.product), up to four levels deep. A single object takes up to 12 paths; a list takes up to 2, applied to every item. Extra paths are dropped without an error. See Expanding objects.

Response Body

The void was made for at least one payment.

application/json
  1. response

The result of capturing or voiding an order: every payment the request acted on, with its own result. An order can have more than one payment, so some can succeed while others fail.

object*"payment_list"

The object type. Always payment_list.

Value in"payment_list"
url*string

The URL of this result.

Formaturi
payment_list_id*string

The id of this result.

test*boolean

True for test payments.

account_id*|

The account the payments belong to.

currency*|

The currency of the payments.

subtotal*number

The subtotal of the payments that are now completed or pending, in currency.

shipping*number

The shipping of the payments that are now completed or pending, in currency.

tax*number

The tax of the payments that are now completed or pending, in currency.

total*number

The total of the payments that are now completed or pending, in currency.

success_count*integer

How many payments succeeded.

failure_count*integer

How many payments failed.

payments*array<>

The payments, each with its new status.

Example Request
curl -X POST 'https://api.comecero.com/api/v1/orders/string/void'
Example Response
{  "object": "payment_list",  "url": "https://api.comecero.com/api/v1/payment_list/0093718312099PlQ8sZr2m",  "payment_list_id": "0093718312099PlQ8sZr2m",  "test": true,  "account_id": "AB1234",  "currency": "USD",  "subtotal": 0,  "shipping": 0,  "tax": 0,  "total": 0,  "success_count": 1,  "failure_count": 0,  "payments": [    {      "object": "payment",      "url": "https://api.comecero.com/api/v1/payments/0090460891496PyrYzd9DC",      "payment_id": "0090460891496PyrYzd9DC",      "account_id": "AB1234",      "success": true,      "status": "cancelled",      "date_created": "2026-11-07T19:25:02Z",      "date_modified": "2026-11-07T19:25:04Z",      "date_completed": "2026-11-07T19:25:04Z",      "test": true,      "currency": "USD",      "subtotal": 199.9,      "shipping": 0,      "tax": 14.99,      "total": 214.89,      "customer_ip_address": "203.0.113.44",      "customer_ip_country": "US",      "description": null,      "reference": null,      "merchant_descriptor": "EXAMPLE SHOP",      "merchant_contact": "shop.example.com",      "apply_to_balance": false,      "response_code": "OK",      "response_message": "OK",      "gateway_transaction_id": "test_ch_1029384756",      "gateway_error_code": null,      "gateway_error_message": null,      "risk_decline": false,      "gateway": "https://api.comecero.com/api/v1/gateways/0090100200300GwTest01",      "app_id": null,      "app_version": null,      "payment_method": "https://api.comecero.com/api/v1/payments/0090460891496PyrYzd9DC/payment_method",      "response_data": "https://api.comecero.com/api/v1/payments/0090460891496PyrYzd9DC/response_data",      "reporting_currency": "USD",      "reporting_subtotal": 199.9,      "reporting_shipping": 0,      "reporting_tax": 14.99,      "reporting_total": 214.89,      "reporting_fx_rate": 1,      "settlement_currency": "USD",      "settlement_subtotal": 199.9,      "settlement_shipping": 0,      "settlement_tax": 14.99,      "settlement_total": 214.89,      "fx_rate": 1,      "customer": "https://api.comecero.com/api/v1/customers/0091307952481CuXUhvCA1",      "order": "https://api.comecero.com/api/v1/orders/8352-CSGYX-348",      "cart": "https://api.comecero.com/api/v1/carts/0091307952465CafhFSTa1",      "invoice": null,      "refunds": "https://api.comecero.com/api/v1/payments/0090460891496PyrYzd9DC/refunds",      "fees": "https://api.comecero.com/api/v1/payments/0090460891496PyrYzd9DC/fees",      "fee_summary": "https://api.comecero.com/api/v1/payments/0090460891496PyrYzd9DC/fee_summary",      "commissions": "https://api.comecero.com/api/v1/payments/0090460891496PyrYzd9DC/commissions",      "failed_gateway_attempts": "https://api.comecero.com/api/v1/payments/0090460891496PyrYzd9DC/failed_gateway_attempts",      "meta": null    }  ]}