Skip to main content

capture Method

Overview

The capture method finalizes an authorized payment by transferring reserved funds to your merchant account.

Business Use Case: An e-commerce order has shipped. Capture the funds to complete the transaction.

Purpose

ScenarioBenefit
E-commerce fulfillmentCharge when orders ship
Service completionBill after service rendered

Request Fields

FieldTypeRequiredDescription
merchantTransactionIdstringYesYour unique transaction reference
connectorTransactionIdstringYesThe connector's transaction ID
amountMoneyNoAmount to capture (can be partial)
descriptionstringNoDescription for statement

Response Fields

FieldTypeDescription
merchantTransactionIdstringYour reference
connectorTransactionIdstringConnector's transaction ID
statusPaymentStatusCAPTURED, PENDING, FAILED
capturedAmountintAmount captured
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...',
'amount' => [
'minorAmount' => 1000,
'currency' => 'USD'
],
'description' => 'Order shipment #12345'
];

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

Response

[
'merchantTransactionId' => 'txn_order_001',
'connectorTransactionId' => 'pi_3Oxxx...',
'status' => 'CAPTURED',
'capturedAmount' => 1000,
'statusCode' => 200
]

Next Steps

  • authorize - Create initial authorization
  • void - Cancel instead of capturing