amzn / amzn/amazon-pay-api-sdk-php
Testing Amazon Pay button on localhost:
- Dominant language
- PHP
- Stars
- 51
- Forks
- 33
- PR merge metrics
- No merged PRs in 30d
Description
To download the **private key** two methods are recommended here:
**Method 1:**
Using the following keys on windows 10 creates ---BEGIN OPENSSH PRIVATE KEY --- file as mentioned in the index page.
ssh-keygen -t rsa -b 2048 -f private.pem
ssh-keygen -f private.pem -e -m PKCS8 > public.pub
**Method 2**
Using https://sellercentral-europe.amazon.com/external-payments/amazon-pay/integration-central 'Create Api Keys', downloads the private key automatically in the left hand corner of the browser eg. AmazonPay_SANDBOX-AGQNBBAR7LO44CKBVHJWB4AB.
This file is a ---BEGIN PRIVATE KEY --- file ie. without the OPENSSH and the RSA.
I was initially getting an invalid Signature error as follows with Method 1: (Security keys have been adjusted)

I am now getting an invalid Login exception as follows with Method 2 thankfully using my live amazon account before I progress to the sandbox.
My question is ... when I begin hosting my website, what type of private key file ie. OPENSSH / RSA / BLANK should I use. It would appear that the `ssh-keygen -t rsa -b 2048 -f private.pem` is not generating a suitable file.
Under the API\Client generateButtonSignature function, I php echoed the $hashedButtonRequest variable in the controller before signing and the view output did in fact match my merchant details. So it would appear the culprit is the file that was generated by the `ssh-keygen -t rsa -b 2048 -f private.pem`.
After creating a test buyer on sellercentral using a different email address, I logged into payments.amazon.co.uk using this buyers email address and successfully received the following page.

.
Contributor guide
Research direction
Start with API\Client generateButtonSignature and the controller/view path where the hashed button request is echoed. Reproduce the reported invalid Signature and invalid Login results with the two key-generation methods, then verify which private-key format the SDK accepts and confirm a successful sandbox flow.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api, payments
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100