Paypal Adaptive API 返回带有令牌的 URL 映射 [英] Paypal Adaptive API return URL mapping with token

查看:55
本文介绍了Paypal Adaptive API 返回带有令牌的 URL 映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试通过使用 Paypal Adaptive API 来解决以下问题.我已将 Paypal Adaptive 链式支付 API 与我的网站集成.当用户点击pay with paypal"按钮时,需要到paypal网站进行支付.我的问题从这里开始

I have been trying to solve the following issue from using Paypal Adaptive API. I have integrated Paypal Adaptive chained payment API with my website. When the user clicks on the "pay with paypal" button, it takes to paypal website for payment. My issues starts from here

  • Paypal 返回到我的 returnURL,但是我如何在返回后绑定原始的付款请求.returnURL 是一个 HTTP GET,没有来自 paypal 的查询参数.
  • 如果我想使用 IPN,这将不允许我在本地 Windows 网络服务器中进行测试,因为它不支持 localhost 或 127.0.0.1.我什至尝试让我的公共 IP 并尝试在我的路由器中放置端口转发,一英寸都没有移动

现在,我希望能够在用户成功付款后将各种付款信息表到我的数据库中,并且在投入生产之前我没有适当的方法在开发中做到这一点

Now, i want to be able to table the various payment information when into my database when the user has successfully paid, and i dont have the proper means to do it in development before putting in production

我很惊讶贝宝这样一家价值 10 亿美元的公司可以向开发人员提供如此无用的代码以进行集成

I am double surprised that a billion dollar company like paypal can deliver such a useless code to developers to integrate

我也看这个答案,Adaptive Payments Paypal:返回没有数据的网址?.贝宝的那个人说

I look at this answer as well, Adaptive Payments Paypal : return url without data? . The guy from paypal says

当用户返回 returnUrl 端点时,您调用 PaymentDetails API 并检查状态并继续.

When the user returns the returnUrl endpoint, you make a call for the PaymentDetails API and check the status and proceed.

问题是调用 PaymentDetails,我需要支付令牌.我怎样才能从 returnurl 获得 paytoken?就像现在一样,返回 URL 没有任何查询参数.

Well the question is to call PaymentDetails, i need paytoken. How can i get paytoken from the returnurl? As it is now, the return URL does not have any query parameters.

推荐答案

在你的 returnUrl 中添加 payKey=${payKey}

例如,如果您的 returnUrl 是 example.com/return.html?myparameter=value - 它会变成 example.com/return.html?myparameter=value&payKey=${payKey}
PayPal 将用实际的 PayKey 替换 ${payKey}.由于它是一个 url,你需要对 returnUrl 的值进行 url 编码 - 所以上面的 url 变成 example.com%2Freturn.html%3Fmyparameter%3Dvalue%26payKey%3D%24%7BpayKey%7D

For example if your returnUrl is example.com/return.html?myparameter=value - it would become example.com/return.html?myparameter=value&payKey=${payKey}
PayPal will replace ${payKey} with the actual PayKey. Since it's a url you would need to url encode the value of the returnUrl - so the above url becomes example.com%2Freturn.html%3Fmyparameter%3Dvalue%26payKey%3D%24%7BpayKey%7D

这是一个示例 curl 命令

curl -s --insecure -H "X-Paypal-Security-Userid: XXX" -H "X-Paypal-Security-Password: XXX" -H "X-Paypal-Security-Signature: XXX" -H "X-Paypal-Request-Data-Format: NV" -H "X-Paypal-Response-Data-Format: NV" -H "X-Paypal-Application-Id: APP-80W284485P519543T" https://svcs.sandbox.paypal.com/AdaptivePayments/Pay -d "requestEnvelope.errorLanguage=en_US&clientDetails.ipAddress=127.0.0.1&clientDetails.deviceId=mydevice&clientDetails.applicationId=PreApprovalNvpDemo&cancelUrl=http%3A%2F%2Flocalhost%2Fcancel.html&currencyCode=USD&actionType=PAY&receiverList.receiver(0).email=pd_1265515509_biz@yahoo.com&&receiverList.receiver(0).amount=100.00&feesPayer=EACHRECEIVER&memo=SimplePay&returnUrl=http%3A%2F%2Flocalhost%2Freturn.html%3FpayKey%3D%24%7BpayKey%7D"

这篇关于Paypal Adaptive API 返回带有令牌的 URL 映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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