PayPal Express 在沙盒模式下返回 4011 错误消息 [英] PayPal Express returns 4011 error message in Sandbox mode
问题描述
我在我的 PHP 脚本(curl + SOAP)中以沙盒模式使用 PayPal express.我有一个带有 1 个购买"按钮的简单购买表格.当它被点击我发送初始 SetExpressCheckout 请求并从贝宝获得成功响应使用 Ack=success 和一个新令牌
I am using PayPal express in Sandbox mode in my PHP script (curl + SOAP). I have a simple purchase form with 1 "buy" button. When it's clicked I send initial SetExpressCheckout request and get successful response from paypal with Ack=success and a fresh token
<Ack xmlns="urn:ebay:apis:eBLBaseComponents">Success</Ack>
<Token xsi:type="ebl:ExpressCheckoutTokenType">EC-4GV76670YM092205U</Token></SetExpressCheckoutResponse>
接下来我尝试使用这个新令牌将脚本重定向到 PayPal:
Next I am trying to redirect script to PayPal with this new token:
header("Location: https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=".$result[Token]."&address_override=1");
但结果 PayPal 显示了一个带有错误消息的页面:
but as a result PayPal displays a page with error message:
很抱歉,我们遇到了暂时的困难.请稍后再试.如果在付款时发生此错误,请在重新付款前检查您的帐户概览,以避免重复付款.消息 4011
是什么导致了这个错误?我使用的是普通的 US/USD Sandbox 帐户,唯一可能看起来可疑的是在 paypal 响应中的 xml 用户名和密码字段为空.
What can have caused this error? I am using a plain US/USD Sandbox account, the only thing that might look suspicious is that in paypal response xml username and password fields are empty.
推荐答案
此错误是由使用 SandBox 凭据导致的,同时重定向到非沙箱 URL.应该是header("位置:https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=".$result[Token]."&address_override=1")
;
This error was cause by using SandBox credentials, while redirecting to non-sandbox URL.
It should've been
header("Location: https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=".$result[Token]."&address_override=1")
;
这篇关于PayPal Express 在沙盒模式下返回 4011 错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!