问题
I am working from this tutorial in Amazon for creating signatures: http://docs.amazonwebservices.com/AmazonFPS/latest/FPSBasicGuide/APPNDX_GeneratingaSignature.html
and I don't understand step a: "Sort the UTF-8 query string components by parameter name with natural byte ordering."
What UTF-8 string are they talking about? Is there maybe a PHP example of doing what they are talking about?
Thanks!!
回答1:
The query string, in this case, is the part of the URL after the "?". What the instructions are telling you is to sort the components of the query string, i.e. the parameters. For example, these parameters:
$param = array();
$param['transactionAmount'] = 1.00;
$param['returnURL'] = 'https://mydomain.com/receipt';
$param['currencyCode'] = 'USD';
Would be sorted into a URL with a query part that looks something like:
http://...?currencyCode=USD&returnURL=httpshttp%3A%2F%2Fmydomain.com%2Freceipt&transactionAmount=1.00
There is a PHP library for making calls to FPS located here. Inside that library is code that signs all of the requests (located in the Amazon_FPS_CBUIPipeline class). I would recommend that you use the library to generate all of your requests.
来源:https://stackoverflow.com/questions/8808385/creating-an-amazon-flexible-payments-signature