0
votes

I create a paypal plus (only avaible in germany) payment process via php and curl. I can successfully create a payment and in the next step paypal redirect me to my shop. At this point i want to check if the customer has changed the shipping address and what payment method he choosed. (paypal plus includes various payment methods like invoice)

I have a valid access token and try this piece of code:

$ch = curl_init();
$headers=array('Content-Type:application/json','Authorization:Bearer '.$access_token); 
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, "https://api.paypal.com/v1/payments/payment/".$_GET['paymentId']);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSLVERSION, 6);
curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, 'SSLv3');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
$json = json_decode($result);

I looked in the documentation and it looks right to me. https://developer.paypal.com/docs/api/payments/#payment_get

The problem is the following. I dont receive information about the created payment with the submitted id($_GET['paymentId']). Instead of this i receive informations about my own payments made with this paypal accounts by other merchants.

What i am doing wrong?

1
It was my fault. The code is fully correct, but the $_GET var was empty, because of a mod_rewrite rule. - Smedi

1 Answers

0
votes

It was my fault. The code is fully correct, but the $_GET var was empty, because of a mod_rewrite rule.