public function PayPalWebsitePaymentsPro::sendNvpRequest in Ubercart 8.4
Sends a request to the PayPal NVP API.
1 call to PayPalWebsitePaymentsPro::sendNvpRequest()
- PayPalWebsitePaymentsPro::chargeCard in payment/
uc_paypal/ src/ Plugin/ Ubercart/ PaymentMethod/ PayPalWebsitePaymentsPro.php - Called when a credit card should be processed.
File
- payment/
uc_paypal/ src/ Plugin/ Ubercart/ PaymentMethod/ PayPalWebsitePaymentsPro.php, line 281
Class
- PayPalWebsitePaymentsPro
- Defines the PayPal Website Payments Pro payment method.
Namespace
Drupal\uc_paypal\Plugin\Ubercart\PaymentMethodCode
public function sendNvpRequest($params) {
$host = $this->configuration['wpp_server'];
$params += [
'USER' => $this->configuration['api']['api_username'],
'PWD' => $this->configuration['api']['api_password'],
'SIGNATURE' => $this->configuration['api']['api_signature'],
'VERSION' => '3.0',
];
try {
$response = \Drupal::httpClient()
->request('POST', $host, [
'form_params' => $params,
]);
parse_str($response
->getBody(), $output);
return $output;
} catch (TransferException $e) {
\Drupal::logger('uc_paypal')
->error('NVP API request failed with HTTP error %error.', [
'%error' => $e
->getMessage(),
]);
}
}