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 successfull response from paypal with Acc=success and a fresh token
<Ack xmlns="urn:ebay:apis:eBLBaseComponents">Success</Ack>
<Token xsi:type="ebl:ExpressCheckoutTokenType">EC-4GV76670YM092205U</Token></SetExpressCheckoutResponse>
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");
but as a result PayPal displays a page with error message:
We are sorry, we are experiencing temporary difficulties. Please try again later. If this error occurred while making a payment, avoid duplicate payments by checking your Account Overview before resending a payment. Message 4011
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.
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")
;
来源:https://stackoverflow.com/questions/2415640/paypal-express-returns-4011-error-message-in-sandbox-mode