Amazon Pay

Introduction

The Amazon Pay integration allows you to sell physical goods and services through Alexa with the whole purchase flow being handled inside the voice experience.

The following documentation will only contain Jovo specific features like helper functions or project.js modifications. Please use the official Amazon documentation for the JSON interfaces, guidelines, etc. You can find them here

Permissions

To use Amazon Pay you have to add it to the permissions your skill needs. For that add the following to your project.js file:

After that build and deploy the files:

To check whether the user granted you the permission you can use the following helper methods:

If the user didn't provide the permission you can prompt them to grant the permission by showing them a card in the Alexa app:

Buyer Id

To get the user's buyer id, you can use the getBuyerId() helper method.

You have to parse the method an options object with the following properties:

Name Description Value Required
host Depending on the user's region, you have to send the api request to different hosts. For NA it's pay-api.amazon.com, for EU & UK it's pay-api.amazon.eu and for JP it's pay-api.amazon.jp String Yes

If your request was successful, you will receive a response object with the following structure:

Name Description Value
buyerId The user's buyer id String

Buyer Address

To access the user's buyer address, you can use the getBuyerAddress() helper method.

You have to parse the method an options object with the following properties:

Name Description Value Required
host Depending on the user's region, you have to send the api request to different hosts. For NA it's pay-api.amazon.com, for EU & UK it's pay-api.amazon.eu and for JP it's pay-api.amazon.jp String Yes
sellerId Your seller id String Yes
sandbox A boolean to specify wether you want to use the sandbox mode or not. The default value is false Boolean No
sandboxEmail The email address for the sandbox user account. Is only required, if sandbox is set to true String No

If your request was successful, you will receive a response object with an array containing all of the user's addresses:

Name Description Value
addresses Array of address objects Object[]
addresses[].address address object Object
addresses[].address.addressLine1 String
addresses[].address.city String
addresses[].address.countryCode String
addresses[].address.name String
addresses[].address.phone String
addresses[].address.postalCode String
addresses[].address.stateOrRegion String
addresses[].addressType String

Default Buyer Address

To get the buyer's default shipping address directly, use getDefaultBuyerAddress().

The function expects the same object as a parameter as getBuyerAddress(). As a response you get the default shipping addresses' object.

Send the Directive

Both the Setup and Charge directive are simply JS objects which you can add to the response using the addDirective() method:

The request you will receive as the response to the directive, Connections.Response will be mapped to the Jovo built-in ON_PURCHASE intent:

For the reference for both the Setup and Charge directive, please use the official Amazon documentation which you can find here.

Payload Builder

For both the Setup and Charge we offer a payload builder. It takes care of all the default values of the payload.

After building the payload using the respective helper methods, you call the build() method, which will return you the final object.

Setup Payload Builder

Name Param
setSellerId() String
setCountryOfEstablishment() Enum - DE, ES, US, UK, etc.
setLedgerCurrency() Enum - USD, EUR, GBP, or JPY
setCheckoutLanguage() Enum - de_DE, en_GB, en_US, es_ES, fr_FR, it_IT, ja_JP
setSellerBillingAgreementId() String
setBillingAgreementType() Enum - CustomerInitiatedTransaction or MerchantInitiatedTransaction
setSubscriptionAmount() String
setSubscriptionCurrencyCode() Enum - USD, EUR, GBP, or JPY
setStoreName() String
setCustomInformation() String
setNeedAmazonShippingAddress() Boolean
setSandboxMode() Boolean
setSandboxEmail() String

Charge Payload Builder

Name Param
setSellerId() String
setBillingAgreementId() String
setPaymentAction() Enum - Authorize or AuthorizeAndCapture
setAuthorizationReferenceId() String
setAuthorizationAmount() String
setAuthorizationCurrencyCode() Enum - USD, EUR, GBP, or JPY
setSoftDescriptor() String
setTransactionTimeout() String
setSellerAuthorizationNote() String
setStoreName() String
setCustomInformation() String
setSellerNote() String
setSellerOrderId() String

Comments and Questions

Any specific questions? Just drop them below or join the Jovo Community Forum.

Join Our Newsletter

Be the first to get our free tutorials, courses, and other resources for voice app developers.