I am using Paypal Rest API in website.
The challenge is I am being stuck at "Continue to Review Order" Button. When I am clicking it infinitely directing to same URL
Find the code below:
$postFields = json_encode(array(
'intent' => 'CAPTURE',
'purchase_units' => array(
array(
'amount' => array(
'currency_code' => $currency,
'value' => $amount
),
'payee' => array(
'email_address' => '[email protected]', //
),
'payer' => array(
'email_address' => '[email protected]' // Payer's email address from session
),
'application_context' => array(
'user_action' => 'PAY_NOW',
'return_url' => 'http://localhost/paypal_success.php?order_id=' . $orderId,
'cancel_url' => 'http://localhost/cancel.php'
)
)
)
));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $paypalApiUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
echo '<script>';
echo 'console.log(' . json_encode($response) . ');';
echo '</script>';
Its opening a page but not going to next screen to review.I am not even getting anything in $response
2
Answers
Either:
application_context
is also a deprecated parameter anyway.