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
| Scenario | Benefit |
|---|---|
| E-commerce fulfillment | Charge when orders ship |
| Service completion | Bill after service rendered |
Request Fields
| Field | Type | Required | Description |
|---|---|---|---|
merchantTransactionId | string | Yes | Your unique transaction reference |
connectorTransactionId | string | Yes | The connector's transaction ID |
amount | Money | No | Amount to capture (can be partial) |
description | string | No | Description for statement |
Response Fields
| Field | Type | Description |
|---|---|---|
merchantTransactionId | string | Your reference |
connectorTransactionId | string | Connector's transaction ID |
status | PaymentStatus | CAPTURED, PENDING, FAILED |
capturedAmount | int | Amount captured |
statusCode | int | HTTP 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
]