简体   繁体   English

PHP PayPal REST API查找付款

[英]PHP PayPal REST API Lookup Payment

I create a paypal plus (only avaible in germany) payment process via php and curl. 我通过php和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 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']). 我没有收到有关带有已提交ID($ _ GET ['paymentId'])的已创建付款的信息。 Instead of this i receive informations about my own payments made with this paypal accounts by other merchants. 取而代之的是,我收到有关其他商人使用此Paypal帐户进行付款的信息。

What i am doing wrong? 我做错了什么?

It was my fault. 这都是我的错。 The code is fully correct, but the $_GET var was empty, because of a mod_rewrite rule. 代码完全正确,但是由于有mod_rewrite规则,$ _ GET var为空。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM