Paypal PHP SDK REST不返回任何“成功"消息.多变的 [英] Paypal PHP SDK REST is not returning any "success" variable

查看:108
本文介绍了Paypal PHP SDK REST不返回任何“成功"消息.多变的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照此处的官方样本说明,在沙盒上进行基本的PayPal付款:

I make basic PayPal payment on sandbox, following instructions on official samples here:

执行

当我的执行服务从Paypal服务器获取请求时,出现问题.转储$ _GET变量后,我可以看到类似的内容:

The problem appears when my Execution service is getting request from paypal server. After dumping $_GET variables I can see something like:

array:3 [▼
  "paymentId" => "PAY-9HM25571EF136871GLEWZM6A"
  "token" => "EC-6VX65808WU776334M"
  "PayerID" => "2ADP8W2S9ST8Z"
]

因此没有称为成功"的变量.如果付款没有成功结束,我应该得到成功":false.我不知道发生了什么,如何解决.

So there is no variable called "success". If payment ended without success I should get "success": false. I have no idea what is going on and how can I fix it.

请寻求帮助,

亚瑟.

推荐答案

成功"不会自动出现.当您进行初始POST v1/Payments调用(创建付款)时,您需要包括以下内容

The "success" is not going to come automatically. When you make your initial POST v1/Payments call (Create Payment) you need to include the below

$baseUrl = getBaseUrl();
$redirectUrls = new RedirectUrls();
$redirectUrls->setReturnUrl("$baseUrl/ExecutePayment.php?success=true")
    ->setCancelUrl("$baseUrl/ExecutePayment.php?success=false");

查看此内容[ http ://paypal.github.io/PayPal-PHP-SDK/sample/doc/payments/CreatePaymentUsingPayPal.html] [1]

基本上,只需确保将成功返回URL指定为类似www.mysite.com/successpage.html?success=true的内容. PYPL将附加付款ID = PAY67S97196TG1078736LIKMI4Q&token = EC37412549V2519404X& PayerID = DNZQ8C57C7P6Q

basically just make sure you specify your success return URL as something like www.mysite.com/successpage.html?success=true . PYPL will append paymentId=PAY67S97196TG1078736LIKMI4Q&token=EC37412549V2519404X&PayerID=DNZQ8C57C7P6Q

这篇关于Paypal PHP SDK REST不返回任何“成功"消息.多变的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆