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
- 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
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
- Assuming that the buyer clicks Amazon Pay button on the cart.
- 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)
- Merchant renders information on order review page using information obtained from Amazon Pay.
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.
- 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
- Assuming that the buyer signed in with your site ID and password, and clicks Amazon Pay butotn on cart page.
- 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)
- Merchant renders information on order review page using information obtained from Amazon Pay.
- 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.