title: Problems encoding Amazon Flexible Payments secret string in PHP
body: <p>I am trying to use Amazon Payment Services, and they require me to do something like this:</p>
  
  <p>Here is the complete signature so you can see I added the signature method:</p>
  
  <pre><code>$string_to_sign = "GET\n
  authorize.payments-sandbox.amazon.com\n
  cobranded-ui/actions/start?
  SignatureMethod=HmacSHA256&amp;SignatureVersion=2&amp;callerKey=my_key&amp;callerReference=YourCallerReference&amp;paymentReason=donation&amp;pipelineName=SingleUse&amp;returnUrl=http%3A%2F%2Fyourwebsite.com%2Freturn.html&amp;transactionAmount=4.0";
  </code></pre>
  
  <p>and then I encrypt it like below.</p>
  
  <pre><code>$encoded_string_to_sign = URLEncode(Base64_Encode(hash_hmac("sha256", $string_to_sign, 'my_secret_key')));
  </code></pre>
  
  <p>I do that, but then I get an error from them saying:</p>
  
  <pre><code>Caller Input Exception: The following input(s) are either invalid or absent:[signatureMethod]
  </code></pre>
  
  <p>Any idea what might be going wrong here?</p>
  
  <p>Here is the entire code for this: (the variables are assigned values above)</p>
  
  <pre><code>&lt;?php
  $string_to_sign = 'GET
  authorize.payments-sandbox.amazon.com/cobranded-ui/actions/startSignatureMethod=HmacSHA256&amp;SignatureVersion=2&amp;callerKey=AKIAJENBYSJCJX2IDWDQ&amp;callerReference=YourCallerReference&amp;paymentReason=donation&amp;pipelineName=SingleUse&amp;returnUrl=http%3A%2F%2Fproblemio.com&amp;transactionAmount=4.0';
  
      $encoded_string_to_sign = URLEncode(Base64_Encode(hash_hmac("sha256", $string_to_sign, 'my_secret_key')));
  
  $amazon_request_sandbox = 'https://authorize.payments-sandbox.amazon.com/cobranded-ui/actions/start?SignatureVersion=2&amp;returnUrl='.$return_url.'&amp;paymentReason='.$payment_reason.'&amp;callerReference=YourCallerReference&amp;callerKey='.$my_access_key_id.'&amp;transactionAmount=4.0&amp;pipelineName=SingleUse&amp;SignatureMethod=HmacSHA256&amp;Signature='.$encoded_string_to_sign;
  
  //echo $amazon_request_sandbox; - use this if you want to see the resulting request and paste it into the browser
  
  header('Location: '.$amazon_request_sandbox);
  ?&gt;
  </code></pre>
  
  <p>Thanks!!</p>