public function PayPalPaymentECPaymentMethodController::doExpressCheckoutPayment in PayPal for Payment 7
Executes a checkout.
Parameters
Payment $payment:
PayPalPaymentECAuthentication $authentication:
Return value
bool Whether the request was successful.
File
- paypal_payment_ec/
includes/ PayPalPaymentECPaymentMethodController.inc, line 218
Class
- PayPalPaymentECPaymentMethodController
- A PayPal Express Checkout payment method.
Code
public function doExpressCheckoutPayment(Payment $payment, $authentication) {
$nvp_request = array(
'METHOD' => 'doExpressCheckoutPayment',
'PAYERID' => $authentication->payerID,
'TOKEN' => $authentication->token,
) + $this
->paymentNVP($payment);
$nvp_response = $this
->NVPAPIRequest($nvp_request, $payment);
if (isset($nvp_response['PAYMENTINFO_0_PAYMENTSTATUS'])) {
$payment_status = $this
->convertStatus($nvp_response);
$payment
->setStatus(new PaymentStatusItem($payment_status));
return TRUE;
}
else {
return FALSE;
}
}