Introducing OpenTelemetry for Chargebee SDKs — trace every API call in any telemetry tool.
Chargebeechargebee API

Void authorizations before capture

Idempotency SupportedAsynchronous

Voids all outstanding scheduled-capture authorizations linked to an invoice before capture, then voids or writes off the invoice.

Use this operation when an invoice has an outstanding delayed-capture authorization that must be released before the invoice is either voided or written off. Use invoice_action to choose whether the invoice is voided or written off.

Prerequisites & Constraints

  • The invoice must have at least one outstanding scheduled-capture authorization with a capturable amount greater than zero.
  • The invoice status must be payment_due, posted, or not_paid.
  • The invoice must not have successful payments, taxes withheld, applied credit notes, adjustment amounts, refundable credits, or refunds in progress.
  • The outstanding authorization must not already have a successful or in-progress capture.
  • This operation is not supported for 2Checkout.

Impacts

Authorizations

  • Chargebee voids all eligible outstanding scheduled-capture authorizations linked to the invoice at the payment gateway.

Invoice

  • When invoice_action is void, Chargebee voids the invoice. The invoice status becomes voided.
  • When invoice_action is write_off, Chargebee writes off the invoice. The invoice status becomes paid, and write_off_amount is set to the invoice amount_due.

Credit Note

  • When invoice_action is write_off, Chargebee creates an adjustment credit note for the write-off. The response includes the credit_note resource when one is generated.

Implementation Notes

Before calling this API, ensure that the scheduled-capture authorization is still outstanding. If it has already been captured, if no eligible authorization remains, or if another conflicting payment operation is in progress, the API returns HTTP 409 with api_error_code set to invalid_state_for_request.

Sample Request

Sample Result[JSON]

URL Format

POST https://[site].chargebee.com/api/v2/invoices/{invoice-id}/void_before_capture

Input Parameters

comment
optional, string, max chars=300

An internal comment to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing Hosted Page or any document such as the Invoice PDF .

void_reason_code
optional, string, max chars=100

Reason code for voiding the invoice. Applicable only when invoice_action is void. Select from the reason codes configured in Settings > Configure Chargebee > Reason Codes > Invoices > Void invoice. This parameter is required when a void reason code is configured as mandatory. The codes are case-sensitive.

invoice_action
optional, enumerated string

Determines whether Chargebee voids or writes off the invoice after voiding all eligible outstanding scheduled-capture authorizations. Possible values are void and write_off. This is not related to Close a pending invoice.

Default value

void

Enum Values
void

Voids the invoice after all eligible outstanding scheduled-capture authorizations are voided.

write_off

Writes off the invoice after all eligible outstanding scheduled-capture authorizations are voided. void_reason_code is not applicable for this value.

Returns

Invoice object

The updated invoice.

Credit note object

The adjustment credit note generated when the invoice is written off. This resource is returned only when a credit note is generated.