Before starting, I have to say know this is probably the moston common error faced by people using PP API and that it's mostly caused by human error.
However, after changing my gateway from sandbox mode to live (changed the api to the right endpoint, added my correct api credentials for live account) I keep getting error 10002.
I have carefully checked all the api details, white spaces, api endpoint etc, so this is starting to drive me crazy.
Here is the api call which works perfectly fine with sandbox.
$ppurl = "https://api-3t.paypal.com/nvp";
$feesforpurchase = calculateFees($planPrice);
$total = $planPrice + $feesforpurchase;
$SetExpressCheckoutURL = $ppurl."?USER=".$apiuser."&PWD=".$apipwd."&SIGNATURE=".$apisig."&METHOD=SetExpressCheckout&VERSION=93&PAYMENTREQUEST_0_PAYMENTACTION=SALE&PAYMENTREQUEST_0_AMT=".$total."&PAYMENTREQUEST_0_ITEMAMT=".$planPrice."&PAYMENTREQUEST_0_SHIPPINGAMT=".$feesforpurchase."&PAYMENTREQUEST_0_CURRENCYCODE=USD&RETURNURL=http://example.com/thanks.php pid=".$pid."&CANCELURL=http://example.com&PAYMENTREQUEST_0_CUSTOM=".base64_encode($userid."-".$planID."-".$total."-".$pid);
$cURL = curl_init();
curl_setopt($cURL, CURLOPT_HEADER, false);
curl_setopt($cURL, CURLOPT_URL, $SetExpressCheckoutURL);
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($cURL, CURLOPT_TIMEOUT, 5);
$response = curl_exec($cURL);
$count++;
if($count >= $max_tries) {
break;
$success = false;
}
}
while(curl_errno($cURL) == 28 OR curl_errno($cURL) == 35 OR curl_errno($cURL) == 7);
if($success == false) {
echo 'Payment failed please retry <br />';
// If it got here it tried 5 times and still didn't get a result.
// More code here for what you want to do...
}
echo 'Curl error: ' . curl_error($cURL);
echo var_dump($response);
Any clue what else may be causing this 10002 error ? Already checked api multiple times and there is absolutely nothing wrong with the credentials, as echoing the checkout url shows.
The curl error also returns 230 so var_dump($response) is string(230).
Curl error: string(230)
Really appreciate any help regarding this