views:

300

answers:

1

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&amp;token=".$result[Token]."&amp;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.

+2  A: 

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&amp;token=".$result[Token]."&amp;address_override=1");

PHP thinker