comecerodocs

Void a payment

POST
/payments/{payment_id}/void

Cancels a pending payment (authorized but not captured), so the hold on the shopper's money is released. Any other status is 422. The payment becomes cancelled and the payment:voided event fires. Any body is ignored. To give back money that was captured, refund the payment instead. Secret and trusted tokens only; a limited token gets 403.

Authorization

headerAuthorizationBearer <token>

A secret, trusted or limited token. See Authentication.

Path Parameters

payment_id*string

The id of the payment.

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.

formatted?boolean

When true, the object also has a formatted child with amounts and dates as display text in the shopper's language and currency (for example $19.99 or November 7, 2026). The default is false. See Localized formatting.

Defaultfalse

Response Body

The voided payment.

application/json
  1. response

Money taken, or being taken, from a customer. status says where the payment is. A payment that needs the shopper to act (PayPal approval, a 3-D Secure check, a Comecero Express Payments confirmation) comes back initiated with what to do in response_data; you finish it with POST /payments/{payment_id}/commit. A limited token does not see the gateway fields or the settlement amounts.

object*"payment"

The object type. Always payment.

Value in"payment"
url*string

The full URL of the payment.

Formaturi
payment_id*string

The id of the payment.

account_id*string

The account the payment belongs to.

success*boolean

True when the gateway accepted the payment or the step so far. True for initiated, processing, pending, completed and cancelled; false for failed.

status*string

initiated: created, waiting for the shopper to approve or pass a check; commit it when they are done. processing: the gateway has it and will answer later (for example ACH); the cart or invoice cannot change meanwhile. pending: authorized, not yet captured; capture or void it. completed: captured. failed: declined or in error. cancelled: voided. refunded and retry are also valid values of the status filter.

Value in"initiated""processing""pending""completed""failed""cancelled""refunded""retry"
date_created*string

When the payment was created.

Formatdate-time
date_modified*string

When the payment was last changed.

Formatdate-time
date_completed*|

When the payment was captured, or null if it is not.

Formatdate-time
test*boolean

True for a test payment.

currency*string

The ISO 4217 currency of the payment.

subtotal*number

The amount without tax and shipping, in currency.

shipping*number

The shipping amount without tax, in currency.

tax*number

The tax, in currency.

total*number

The amount charged, in currency.

customer_ip_address*|

The IP address the payment was made from.

customer_ip_country*|

The ISO 3166-1 alpha-2 country of customer_ip_address.

description*|

Your description of the payment.

reference*|

Your own reference for the payment. You can filter lists on it.

merchant_descriptor*|

What appears on the shopper's card statement.

merchant_contact*|

The contact shown with the statement descriptor, such as a phone number or web address.

apply_to_balance*boolean

True when the captured total is added to the customer's store credit balance.

response_code?string

OK for a successful step, otherwise a code for why the payment failed. Not returned to a limited token.

response_message?string

A readable message for response_code. Not returned to a limited token.

gateway_transaction_id?|

The gateway's own id for the transaction. Not returned to a limited token.

gateway_error_code?|

The gateway's error code when the payment failed. Not returned to a limited token.

gateway_error_message?|

The gateway's error message when the payment failed. Not returned to a limited token.

risk_decline?boolean

True when the payment was declined for fraud risk. Not returned to a limited token.

gateway?|

The URL of the gateway used, or the gateway with expand=gateway. Only for a token that may read gateways. Not returned to a limited token.

debug?string

Only on accounts on the agent model. The URL of the raw gateway exchanges for this payment, for troubleshooting. Not returned to a limited token.

Formaturi
app_id?|

The hosted app the payment came from, if any. Not returned to a limited token.

app_version?|

The version of that app. Not returned to a limited token.

payment_method*|

The URL of the payment method used, or the method itself with expand=payment_method.

response_data*|

The URL of the payment's response data, or the data itself with expand=response_data. This is where a redirect, a 3-D Secure step or the Stripe.js values for an initiated payment are.

reporting_currency*|

Your account's reporting currency.

reporting_subtotal*number

subtotal in reporting_currency.

reporting_shipping*number

shipping in reporting_currency.

reporting_tax*number

tax in reporting_currency.

reporting_total*number

total in reporting_currency.

reporting_fx_rate*number

The rate from the settlement currency to reporting_currency.

reporting_alt_currency?string

Your second reporting currency. Only present when you set one.

reporting_alt_subtotal?number

subtotal in reporting_alt_currency. Only present with a second reporting currency.

reporting_alt_shipping?number

shipping in reporting_alt_currency. Only present with a second reporting currency.

reporting_alt_tax?number

tax in reporting_alt_currency. Only present with a second reporting currency.

reporting_alt_total?number

total in reporting_alt_currency. Only present with a second reporting currency.

reporting_alt_fx_rate?number

The rate to reporting_alt_currency. Only present with a second reporting currency.

settlement_currency?string

The currency the payment settles to your account in. Not returned to a limited token.

settlement_subtotal?number

subtotal in settlement_currency. Not returned to a limited token.

settlement_shipping?number

shipping in settlement_currency. Not returned to a limited token.

settlement_tax?number

tax in settlement_currency. Not returned to a limited token.

settlement_total?number

total in settlement_currency. Not returned to a limited token.

fx_rate?number

The rate from currency to settlement_currency. Not returned to a limited token.

customer?|

The URL of the customer, or the customer with expand=customer.

order?||

The URL of the order the payment paid for, the order with expand=order, or null.

cart?||

The URL of the cart the payment was for, the cart with expand=cart, or null.

invoice?||

The URL of the invoice the payment was for, the invoice with expand=invoice, or null.

refunds?|

The URL of the payment's refunds, or an offset list of them with expand=refunds (not inside a list).

fees?|

The URL of the payment's fees, or an offset list of them with expand=fees (not inside a list). Not returned to a limited token.

fee_summary?|

The URL of the payment's fee summary, or the summary with expand=fee_summary. Not returned to a limited token.

commissions?|

The URL of the payment's commissions, or an offset list of them with expand=commissions (not inside a list). Not returned to a limited token.

failed_gateway_attempts?|

The URL of the gateways that declined before this one took the payment. For staff troubleshooting. Not returned to a limited token.

meta*||

Your own data for the payment, a string or an object.

formatted?

Money amounts and dates as display strings. Only present with formatted=true.

Example Request
curl -X POST 'https://api.comecero.com/api/v1/payments/string/void'
Example Response
{  "object": "payment",  "url": "https://api.comecero.com/api/v1/payments/0090460891496PyrYzd9DC",  "payment_id": "0090460891496PyrYzd9DC",  "account_id": "AB1234",  "success": true,  "status": "completed",  "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}