title: How do I get the Security Token for PayPal Payments Advanced gateway integration?
body: <p>We have PayPal Payments Advanced and I'm unable to get past the first gateway integration step. Perhaps I'm missing something simple that should be obvious.</p>
  
  <p>All the official PayPal documents I've been able to find for integrating the gateway for Advanced say the first step is to obtain a Secure Token. The page at
  <a href="https://developer.paypal.com/webapps/developer/docs/classic/payflow/gs_ppa_hosted_pages/" rel="nofollow">https://developer.paypal.com/webapps/developer/docs/classic/payflow/gs_ppa_hosted_pages/</a>
  for example.</p>
  
  <p>I'm posting my test script below (sensitive info modified).</p>
  
  <p>Every time I run the test script, I get a "Error: Your transaction can no longer be processed. Please return to the merchant's web site or contact the merchant. Error: 160" error message.</p>
  
  <p>According to the PayPal Gateway Developer Guide and Reference, error 160 is, "Secure Token already been used. Indicates that the secure token has expired due to either a successful transaction or the token has been used three times while trying to successfully process a transaction. You must generate a new secure token."</p>
  
  <p>Yet, the secure token has not already been used. A new one is generated every time the script is run.</p>
  
  <p>"Enable Secure Token" is set to "Yes" in PayPal Manager.</p>
  
  <p>Here is the script. What am I doing wrong?</p>
  
  <pre><code>&lt;?php
  $url = 'https://payflowlink.paypal.com';
  #$url = 'https://pilot-payflowlink.paypal.com';
  
  $token = md5( 'Will Bontrager' . time() );
  
  /* $info assignment is all one line. Multi-line here for readability */
  $info = "PARTNER=PayPal&amp;
  VENDOR=CertainReservations&amp;
  USER=ABC123&amp;
  PWD=321cba&amp;
  TRXTYPE=S&amp;
  AMT=23.45&amp;
  CREATESECURETOKEN=Y&amp;
  SECURETOKENID=$token";
  
  echo "&lt;pre&gt;Value:$info&lt;/pre&gt;";
  
  $options = array(
  CURLOPT_RETURNTRANSFER =&gt; true,
  CURLOPT_HEADER         =&gt; false,
  CURLOPT_VERBOSE        =&gt; false,
  CURLOPT_SSL_VERIFYHOST =&gt; 0,
  CURLOPT_SSL_VERIFYPEER =&gt; false,
  CURLOPT_POST           =&gt; 1,
  CURLOPT_POSTFIELDS     =&gt; $info
  );
  $ch = curl_init($url);
  curl_setopt_array($ch,$options);
  $content = curl_exec($ch);
  $err = curl_errno($ch);
  $errmsg = curl_error($ch) ;
  $info = curl_getinfo($ch);
  curl_close($ch);
  if( $err )
  {
  echo "&lt;pre&gt;Error. $err\n$errmsg\n";
  print_r($info);
  echo '&lt;/pre&gt;';
  }
  echo $content;
  ?&gt;
  </code></pre>
  
  <p>Thank you very much for any guidance.</p>
  
  <p>I think I must be missing some critical information.</p>
  
  <p>Will</p>