Skip to main content

Flow

Prerequisites

Amazon SignIn enables buyer to signs in merchants website using Amazon login. To make this work, merchant needs to get Amazon buyer's unique ID (buyerId) from Amazon Pay and store it together with mermber ID in member database.

Note buyerId is also returned in API response when you use Amazon Pay (checkout flow). This means you can also save buyerId with merchant site's member ID in member databse during checkout flow

How merchant can get buyer information?
  • With Amazon Pay (checkout), buyer information is returned as a response of Get Checkout Session API etc
  • With Amazon SignIn (signIn), buyer information is returned as a response of Get Buyer API
caution

When the buyer logs in with Amazon SignIn, the buyer already has an intention to pay with Amazon Pay, so please show Amazon Pay as a default payment method for the buyer in checkout flow.


buyerId linking flow

Below explans the flow how to link buyerId with your site member ID.

1. Guest buyer checkout flow

  1. Assuming that the buyer clicks Amazon Pay button on the cart.
  2. The buyer is redirected to Amazon Pay Hosted page, and signs in with Amazon and Continue. Amazon Pay then redirects buyer to merchant's URL, so merchant calls Get Checkout Session API to get data(In API response, you get buyer information such as buyerId, email address, name, billing address and phone number in addition to shipping address, payment instrument)
  3. Merchant renders information on order review page using information obtained from Amazon Pay.
info

If you mandate buyer to sign-up, you may want to use Amazon's buyer information and billing address as fill-in to your signup input form to reduce buyer's input load as much as possible.

In case you will integrate Amazon SignIn, buyer even doesn't need to know merchant site's ID and password, so password input field may be unnecessary.

  1. The buyer confirms order detail and click "Place Order" button on order review page. Then you complete checkout, and store buyer's data in member database. At this timing, you will also store buyerId linked to member ID.

When the buyer visits your site next time,

  • In case the buyer clicks Amazon SignIn button on your sign-in page, and signed in on Amazon Pay Hosted page,
    you call Get Buyer API to get buyerId, and search this buyerId in your member database.
    If matched, you sign in the member to your site in backend.
  • In case the buyer doesn't sign in first, but goes to cart page, and clicks Amazon Pay button on cart page,
    you call Get Checkout Session API to get buyerId, and search this buyerId in your member database.
    If matched, you sign in the member to your site in backend, and continue checkout.

2. Existing member checkout flow

  1. Assuming that the buyer signed in with your site ID and password, and clicks Amazon Pay butotn on cart page.
  2. The buyer is redirected to Amazon Pay Hosted page, and signs in with Amazon and Continue. Amazon Pay then redirects buyer to merchant's URL, so merchant calls Get Checkout Session API to get data(In API response, you get buyer information such as buyerId, email address, name, billing address and phone number in addition to shipping address, payment instrument)
  3. Merchant renders information on order review page using information obtained from Amazon Pay.
  4. The buyer confirms order detail and click "Place Order" button on order review page. Then you complete checkout, and store buyerId in member database together with member ID.

When the buyer visits your site next time,

  • In case the buyer clicks Amazon SignIn button on your sign-in page, and signed in on Amazon Pay Hosted page,
    you call Get Buyer API to get buyerId, and search this buyerId in your member database.
    If matched, you sign in the member to your site in backend.
  • In case the buyer doesn't sign in first, but goes to cart page, and clicks Amazon Pay button on cart page,
    you call Get Checkout Session API to get buyerId, and search this buyerId in your member database.
    If matched, you sign in the member to your site in backend, and continue checkout.

3. Social ID linkage feature

If you use Social ID linkage feature, and want to integrate Amazon SignIn as one of options, buyer can link Amazon buyerId with member ID outside of checkout flow.

Flow diagram

Checkout flow

  • Guest checkout flow: Please see Guest checkout + sign-up flow

  • Existing buyer checkout flow: Please see Existing member buyer flow
    In addition to what's done in the flow, you will save Amazon buyerId(you got from Get Checkout Session API) in member database together with member ID when checkout is complete.

Below flow diagram shows the buyer sign-in flow who's member ID is already linked with Amazon buyerId in past session.

In case the buyer clicks Amazon SignIn button on sign-in page.

Merchant siteAmazon Pay Hosted page for signInMerchant processingMerchant site
Merchant shows sign-in page.
Amazon SignIn button is also shown on the page.
The buyer clicks Amazon SignIn button.
● ● ●
Sign-in page
Sign in with other IDs
Amazon SignIn
▶︎
The buyer is redirected to Amazon Pay Hosted page, and signs in with Amazon ID and passowrd.
▶︎
After signed in, the buyer clicks "Continue" button.
Amazon Pay Hosted page
✔️
Signed in with Amazon

▶︎
After buyer clicks "Continue", Amazon redirects to signInReturnUrl set in signInConfig.payloadJSON. Amazon adds buyerToken to this URL as URL parameter.
i.e. https://anyurl.com/signIn/? buyerToken=26be7331-7dc2-4722-be22-f7e75582d3ef
▶︎
Merchant calls Get Buyer API using buyerToken
Merchant receives buyer information (including buyerId), billing address and shipping address etc as API response.
Get Buyer API reponse sample
▶︎
Merchant searches buyerId in member database.
If matched, merchant signs in the buyer as member to the site in backend
▶︎
Merchant shows after-sign-in page.

In case buyer clicks Amazon Pay button without sign-in

Merchant siteAmazon Pay Hosted pageMerchant processingMerchant site
Merchant adds Amazon Pay button rendering script to show Amazon Pay button on merchant site.
The buyer clicks Amazon Pay button.
● ● ●
Cart page
Amazon Pay
▶︎
Screen and processing are same with General flow - Amazon Pay Hosted page in general.
▶︎
Merchant then call Get Checkout Session API with amazonCheckoutSessionId.
Merchant receives shipping address, payment instruments as API response
Ref: Get Checkout Session response
▶︎
Merchant searches buyerId in member database.
If matched, merchant signs in the buyer as member to the site in backend, and continues checkout.
▶︎
Merchant shows information received in API response (shipping address, payment instrument and etc) on merchant order review page
● ● ●
Order review page
Shipping address
〒153-0064
Shimomeguro 1-8-1, Meguro, Tokyo
Amazon Taro

Payment instrument
VISA 1111xxxx (Amazon Pay)

Order detail
Item
Price
Quant.
Total
Coffee Beans
Coffee beans
¥2,000
1
¥2,000
Coffee Beans
Coffee cup
¥500
1
¥500
Total
¥2,500