doucong7963 2016-08-11 07:46
浏览 272

PHP PayPal REST API查询付款

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条回答 默认 最新

  • 普通网友 2016-08-11 12:20
    关注

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

    评论

报告相同问题?

悬赏问题

  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答