Skip to main content

void Method

Overview

The void method cancels an authorized payment before funds are captured. This releases held funds back to the customer.

Business Use Case: A customer cancels their order before it ships. Void the authorization to release funds.

Purpose

ScenarioBenefit
Order cancellationRelease funds
Fulfillment failureClean up authorization

Request Fields

FieldTypeRequiredDescription
merchantTransactionIdstringYesYour unique transaction reference
connectorTransactionIdstringYesThe connector's transaction ID
voidReasonstringNoReason for voiding

Response Fields

FieldTypeDescription
merchantTransactionIdstringYour reference
connectorTransactionIdstringConnector's transaction ID
statusPaymentStatusVOIDED
statusCodeintHTTP status code

Example

SDK Setup

use OrchestratorXPrism\PaymentClient;

$paymentClient = new PaymentClient([
'connector' => 'stripe',
'apiKey' => 'YOUR_API_KEY',
'environment' => 'SANDBOX'
]);

Request

$request = [
'merchantTransactionId' => 'txn_order_001',
'connectorTransactionId' => 'pi_3Oxxx...',
'voidReason' => 'Customer cancelled order'
];

$response = $paymentClient->void($request);

Response

[
'merchantTransactionId' => 'txn_order_001',
'connectorTransactionId' => 'pi_3Oxxx...',
'status' => 'VOIDED',
'statusCode' => 200
]

Next Steps