Amazon Pay API Integration

Creating Amazon Pay App And Adding Your Domain

  1. Go to Integration → Integration Central

  2. Go to Manage client ID/store ID(s) section at the bottom of the page and click “Create new client ID/store ID” or click “View client ID/store ID(s)” and “Edit” to update existing app.

  3. Add your lander domain to JavaScript origins and return URLs and create or update.

Obtain Amazon Pay MID Credentials

  1. Go to IntegrationMWS Access Key

  2. Click the gold “Copy your keys” button at the top right

  3. Copy the credentials shown in the popup.

Create Amazon Pay MID

  1. In the CRM, go to Merchants->MID List

  2. Click the green plus sign to create a new MID

  3. Select Amazon Pay as Gateway field

  4. Fill in copied credentials (merchant_id, access_key, secret_key, client_id, client_secret)

  5. Fill in MID Title, Descriptor, MID #

  6. Click “Create MID”

Add Amazon Pay Widgets and JavaScript to Your Lander Code

Sample Code from Amazon docs:

For more information on adding Amazon Pay widgets and Javascript visit https://developer.amazon.com/docs/amazon-pay-onetime/add-a-button.html

Send Amazon Pay Parameters with Import Order API Call

Send these parameters during Import Order API call

  • paySource: “AMAZON”

  • amazonBillerId: ID of Amazon Pay MID in the CRM (found on the MID List page)

  • amazonAddressConsent: access_token returned to your checkout page via the URL by Amazon

  • amazonOrderId: obtained in the AddressBook onOrderReferenceCreate function with orderReference.getAmazonOrderReferenceId();

Transaction Flow

Customer clicks Amazon-generated Amazon Pay button on checkout page.

New window pops up for customer to log into Amazon

Customer returned to checkout page with access_token in URL query string.

access_token is used with Amazon profile API to obtain the firstName, lastName, and emailAddress parameters to send on Import Order API call. Send profileResponse.email as emailAddress parameter on Import Order API call. Parse profileResponse.name and send as firstName and lastName parameters on Import Order API call.

Call functions to display the Amazon AddressBook and Wallet widgets.

Obtain Amazon Order Reference ID to send on Import Order API call as amazonOrderId parameter in the AddressBook onOrderReferenceCreate function with orderReference.getAmazonOrderReferenceId();

Customer chooses shipping address and payment method from Amazon-generated widgets.

Import Order with parameters: paySource=AMAZON, amazonBillerId, amazonOrderId, amazonAddressConsent (access_token).

Upsells

Repeat JavaScript process on your upsell page and send amazonBillerId, amazonOrderId, amazonAddressConsent on Import Upsale API call.

Enable Recurring Payments

Follow the same integration steps as for one-time payments above and replace the Amazon AddressBook and Wallet widget code and add the Consent widget code as follows:

For more information on adding Amazon Pay widgets and Javascript visit https://developer.amazon.com/docs/amazon-pay-automatic/add-address-and-wallet-widgets.html

The customer will be required to check the “Use my selected payment method for future purchases and payments to this merchant” box in the Amazon-generated consent widget to complete the purchase.

Send the amazonBillingAgreementId as the amazonOrderId parameter on your Import Order API call.


Errors/Decline Messages

Below you will find common errors that other users have encountered when using Amazon Pay.

Error
Cause
Fix

InvalidPaymentMethod

The customer’s payment method inside Amazon is no longer valid.

Customer must ensure that all payment methods inside their Amazon account are valid.

Last updated