public function CheckoutSdk::capturePayment in Commerce PayPal 8
Captures an authorized payment, by ID.
Parameters
string $authorization_id: The PayPal-generated ID for the authorized payment to capture.
array $parameters: (optional An array of parameters to pass as the request body.
Return value
\Psr\Http\Message\ResponseInterface The HTTP response.
Overrides CheckoutSdkInterface::capturePayment
File
- src/
CheckoutSdk.php, line 169
Class
- CheckoutSdk
- Provides a replacement of the PayPal SDK.
Namespace
Drupal\commerce_paypalCode
public function capturePayment($authorization_id, array $parameters = []) {
$options = [
'headers' => [
'Content-Type' => 'application/json',
],
];
if ($parameters) {
$options['json'] = $parameters;
}
return $this->client
->post(sprintf('/v2/payments/authorizations/%s/capture', $authorization_id), $options);
}