title: Paypal Adaptive Payments works in sandbox mode but not production
body: <p>I'm trying to use Paypal's adaptive payments API and having a tough time switching it to production. Everything works as expected on sandbox mode and I get a proper response, but when I switch to my live APP ID it doesn't work. </p>
  
  <p>These are the configuration values I'm using for sandbox</p>
  
  <pre><code>PayPal URL : https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay?paykey=[TOKEN_HERE]
  Application ID : APP-80W284485P519543T
  </code></pre>
  
  <p>These values work for me in sandbox mode. But when I switch to the below production values, it stops working</p>
  
  <pre><code>PayPal URL : https://www.paypal.com/webapps/adaptivepayment/flow/pay?paykey=[TOKEN_HERE]
  Application ID : [ACTUAL APP ID]
  
  This is what I mean by stops working.
  </code></pre>
  
  <ul>
  <li>In production mode, the application gets the paykey</li>
  <li>Appends it to the Paypal URL and then redirects it to their site</li>
  <li>On site load, I get the following message </li>
  </ul>
  
  <p> </p>
  
  <pre><code>This transaction has already been approved. Please visit your PayPal Account Overview to see the details
  </code></pre>
  
  <p>The final URL it ends up on - <code>https://ic.paypal.com/webapps/adaptivepayment/flow/payinit?execution=e6s1</code> </p>
  
  <p>Screenshot - <a href="http://screencast.com/t/28qJZ9CIk" rel="nofollow">http://screencast.com/t/28qJZ9CIk</a></p>
  
  <p>There is also a 'Return' button there, and when I click on it I get taken to a different site each time (Looks like I get sent to random failUrls)</p>
  
  <p>I've included the code I use below </p>
  
  <pre><code>$payRequest = new PayRequest();
  $payRequest-&gt;actionType     = "PAY";
  $payRequest-&gt;cancelUrl      = $cancelURL; //my success and fail urls
  $payRequest-&gt;returnUrl      = $returnURL;
  
  $payRequest-&gt;clientDetails  = new ClientDetailsType();
  $payRequest-&gt;clientDetails-&gt;applicationId   = $this-&gt;config['application_id'];
  $payRequest-&gt;clientDetails-&gt;deviceId        = $this-&gt;config['device_id'];
  $payRequest-&gt;clientDetails-&gt;ipAddress       = $this-&gt;CI-&gt;input-&gt;ip_address();
  
  $payRequest-&gt;currencyCode = $currencyCode;
  
  $payRequest-&gt;requestEnvelope = new RequestEnvelope();
  $payRequest-&gt;requestEnvelope-&gt;errorLanguage = "en_US";
  
  //I set the receiver and the amounts. I also define that these are digital goods payments       
  $receiver1 = new receiver();
  $receiver1-&gt;email   = $opts['receiver_email'];
  $receiver1-&gt;amount  = $opts['amount'];
  $receiver1-&gt;paymentType = 'DIGITALGOODS';
  $payRequest-&gt;receiverList = new ReceiverList();
  $payRequest-&gt;receiverList = array($receiver1);
  
  //Then I make the call
  $ap          = new AdaptivePayments();
  $response    = $ap-&gt;Pay($payRequest);
  
  if(strtoupper($ap-&gt;isSuccess) == 'FAILURE') {
      log_message('error', "PAYMENT_FAIL : " . print_r($ap-&gt;getLastError(), true));
      return false;
  } else {
      if($response-&gt;paymentExecStatus == "COMPLETED")  {
          header("Location: " . $this-&gt;config['success_url']);
          exit;
      } else {
          $token      = $response-&gt;payKey;
          $payPalURL  = $this-&gt;config['paypal_redirect_url'] . 'paykey='.$token;
          header("Location: ".$payPalURL);
          exit;
      }
  }
  </code></pre>
  
  <p>This is code taken from their sample implementation, so not really sure what's going wrong here. Other information that might be relevant</p>
  
  <ul>
  <li><p>I'm using adaptive payments to make sure that the sender and receiver
  actually did the transaction</p></li>
  <li><p>I have set the payment type as 'DIGITAL GOODS'</p></li>
  </ul>
  
  <p><strong>EDIT</strong></p>
  
  <p>I've included a sample URL with the pay key attached </p>
  
  <pre><code>https://www.paypal.com/webapps/adaptivepayment/flow/pay?paykey=AP-0H388650F08226841
  </code></pre>