Skip to main content

void Method

Overview

The void method cancels an authorized payment before funds are captured. This releases the held funds back to the customer's payment method, effectively canceling the transaction.

Business Use Case: A customer cancels their order before it ships. The payment was authorized at checkout, but since you're not shipping, you void the authorization to release the hold on their funds.

Purpose

Why use void?

ScenarioBenefit
Order cancellationRelease funds when customer cancels
Fulfillment failureVoid if item is out of stock
Authorization timing outClean up old authorizations
Fraud preventionVoid suspicious transactions before capture

Key outcomes:

  • Held funds released immediately
  • No charge to customer
  • Transaction terminated cleanly

Request Fields

FieldTypeRequiredDescription
merchant_transaction_idstringYesYour unique transaction reference
connector_transaction_idstringYesThe connector's transaction ID from authorize
void_reasonstringNoReason for voiding

Response Fields

FieldTypeDescription
merchant_transaction_idstringYour transaction reference (echoed back)
connector_transaction_idstringConnector's transaction ID
statusPaymentStatusCurrent status: VOIDED
voided_amountint64Amount voided in minor units
status_codeintHTTP-style status code (200, 404, etc.)

Example

SDK Setup

from orchestratorx_prism import PaymentClient

payment_client = PaymentClient(
connector='stripe',
api_key='YOUR_API_KEY',
environment='SANDBOX'
)

Request

request = {
"merchant_transaction_id": "txn_order_001",
"connector_transaction_id": "pi_3Oxxx...",
"void_reason": "Customer cancelled order"
}

response = await payment_client.void(request)

Response

{
"merchant_transaction_id": "txn_order_001",
"connector_transaction_id": "pi_3Oxxx...",
"status": "VOIDED",
"voided_amount": 1000,
"status_code": 200
}

Void vs Refund

ActionWhen to UseEffect on Customer
VoidBefore capture, during authorization holdFunds released immediately, no charge
RefundAfter capture, funds already transferredFunds returned, may take 5-10 days

Error Handling

Error CodeMeaningAction
404Transaction not foundVerify connector_transaction_id
409Already capturedCannot void, use refund instead
410Already voidedAlready voided, idempotent result

Best Practices

  • Void as soon as you know the transaction won't complete
  • Void is cheaper than refund (no chargeback risk, no settlement costs)
  • Authorizations typically expire in 7-10 days if not captured

Next Steps

  • authorize - Create initial authorization
  • capture - Complete payment instead of voiding
  • refund - Return funds after capture