authorize(). You can capture the full authorized amount or a partial amount.
Method signature
Parameters
The transaction ID returned from a prior
authorize() call. This identifies which authorization to capture.Partial capture amount in smallest currency unit. Omit this parameter to capture the full authorized amount.
Unique key to prevent duplicate captures when retrying the same request.
Returns
Normalized payment result with status
"completed" for successful captures.Error handling
Thecapture() method may throw the following errors:
VaultIdempotencyConflictError
VaultIdempotencyConflictError
Thrown when an idempotency key is reused with different request data.
VaultRoutingError
VaultRoutingError
Thrown when the provider for the original transaction cannot be found.
Provider-specific errors
Provider-specific errors
The provider may return errors such as:
- Authorization not found
- Authorization already captured
- Authorization expired
- Capture amount exceeds authorized amount
Example
Implementation details
The capture operation (src/client/vault-client.ts:210-244):
- Looks up the provider that handled the original authorization using the transaction index
- Falls back to the first configured provider if the transaction is not found in the index
- Executes the capture through the provider adapter
- Normalizes the provider response into a standard
PaymentResultformat - Records the capture transaction in the provider index
- Queues transaction report to the platform for analytics
The capture uses the same provider that processed the original authorization. Provider selection is based on transaction lookup, not routing rules.