I am working from these instructions in Amazon with PHP: http://docs.amazonwebservices.com/AmazonFPS/latest/FPSBasicGuide/APPNDX_GeneratingaSignature.html
and here is how I make my signature:
$string_to_sign = "GET\nauthorize.payments-sandbox.amazon.com\n/cobranded-ui/actions/start\n
SignatureMethod=HmacSHA256&SignatureVersion=2&callerKey='.$my_access_key_id.'&callerReference='.$caller_reference.'&paymentReason='.$payment_reason.'&pipelineName=SingleUse&returnUrl='.$return_url.'&transactionAmount=1.1";
$encoded_string_to_sign = URLEncode(Base64_Encode(hash_hmac("sha256", $string_to_sign, "1")));
But I am not sure why the signature isn't encoded correctly. One thing to look at is the hash_hmac("sha256", $string_to_sign, "1")
where I randomly put the "1" because Amazon didn't give instructions for what other thing to put in there. How do I know which key in that function Amazon needs me to place? I didn't notice it in their instructions. But maybe it is something else I am doing wrong?
The value to use for the
$key
parameter is your Secret Key that you were issued by Amazon.As I explained in the answer to your last question, you really should have a look at the code included in the FPS PHP library.