Skip to main content

Step4 Operation after Amazon SignIn button click

Buyer experience after Amazon SignIn button click

1. When buyer clicks Amazon SignIn button that you rendered in Step3, buyer is redireted to Amazon hosted page, and signs in with Amazon.

2. Once buyer signs in, a buyer clicks "Continue" button on the next page.

3. Amazon Pay redirects buyer to merchant's site.

Merchant operation occurs at this timing

4. Show signIn success or error page based on API response.

See SignIn flow if you want to review in a diagram.



Merchant Operation

(Between #3 and #4 above)

1. Get Buyer API

Amazon redirects buyer to signInReturnUrl provided in Amazon SignIn button rendering script. When redirecting, Amazon Pay adds buyerToken as URL parameter. i.e. https://anyurl.com/signIn/ ?buyerToken=26be7331-7dc2-4722-be22-f7e75582d3ef

When redirected, you get buyerToken from URL parameter, (in sample case, it's "26be7331-7dc2-4722-be22-f7e75582d3ef") and use it as parameter to call Get Buyer API to get buyer's information to use on your site.

  • Get Buyer API
  • If you are using SDK, you can find function by name like getBuyer.

API response

note
{
buyerId: 'amzn1.account.xxxxxxx',
name: 'Pay Tester',
email: 'jp-amazonpay-tester@amazon.co.jp',
postalCode: '153-0064',
countryCode: 'JP',
phoneNumber: '+0398765432',
shippingAddress: {
name: '七姓 名',
addressLine1: '目黒区下目黒1-8-1 メゾン・コート 101号',
addressLine2: null,
addressLine3: null,
city: null,
county: null,
district: null,
stateOrRegion: '東京都',
postalCode: '153-0064',
countryCode: 'JP',
phoneNumber: '09011112222'
},
billingAddress: {
name: '請求先テスト',
addressLine1: '品川区上大崎 3-1-1',
addressLine2: '目黒セントラルスクエア',
addressLine3: null,
city: null,
county: null,
district: null,
stateOrRegion: '東京都',
postalCode: '141-0021',
countryCode: 'JP',
phoneNumber: '+0398765432'
},
primeMembershipTypes: null
}

Check if buyerId in Get Buyer API response exists in member DB.
If exists, complete signin to your website as your member.
If not exists, show login error page to a buyer.

Use Get Buyer API response to support member signup process.
Member signup = storing member data in member DB, save buyerId as additional member unique key for Amazon Pay signIn (with this, a buyer can signin your website with Amazon credential from next time).