sha256 - Problems encoding Amazon Flexible Payments secret string in PHP -
sha256 - Problems encoding Amazon Flexible Payments secret string in PHP -
i trying utilize amazon payment services, , require me this:
here finish signature can see added signature method:
$string_to_sign = "get\n authorize.payments-sandbox.amazon.com\n cobranded-ui/actions/start? signaturemethod=hmacsha256&signatureversion=2&callerkey=my_key&callerreference=yourcallerreference&paymentreason=donation&pipelinename=singleuse&returnurl=http%3a%2f%2fyourwebsite.com%2freturn.html&transactionamount=4.0";
and encrypt below.
$encoded_string_to_sign = urlencode(base64_encode(hash_hmac("sha256", $string_to_sign, 'my_secret_key')));
i that, error them saying:
caller input exception: next input(s) either invalid or absent:[signaturemethod]
any thought might going wrong here?
here entire code this: (the variables assigned values above)
<?php $string_to_sign = 'get authorize.payments-sandbox.amazon.com/cobranded-ui/actions/startsignaturemethod=hmacsha256&signatureversion=2&callerkey=akiajenbysjcjx2idwdq&callerreference=yourcallerreference&paymentreason=donation&pipelinename=singleuse&returnurl=http%3a%2f%2fproblemio.com&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&returnurl='.$return_url.'&paymentreason='.$payment_reason.'&callerreference=yourcallerreference&callerkey='.$my_access_key_id.'&transactionamount=4.0&pipelinename=singleuse&signaturemethod=hmacsha256&signature='.$encoded_string_to_sign; //echo $amazon_request_sandbox; - utilize if want see resulting request , paste browser header('location: '.$amazon_request_sandbox); ?>
thanks!!
check if included &signaturemethod=hmacsha256
on request
this kind of errors has 3 basic natures:
missing keys/values typos on keys/values incorrect encoding or spaces on keys/valueshope helps!
regards
php sha256 amazon-fps
Comments
Post a Comment