--- title: "Amazon Pay Drop-in" description: "Add Amazon Pay to an existing Drop-in integration." url: "https://docs.adyen.com/payment-methods/amazon-pay/web-drop-in" source_url: "https://docs.adyen.com/payment-methods/amazon-pay/web-drop-in.md" canonical: "https://docs.adyen.com/payment-methods/amazon-pay/web-drop-in" last_modified: "2021-07-26T11:54:00+02:00" language: "en" --- # Amazon Pay Drop-in Add Amazon Pay to an existing Drop-in integration. Our Web Drop-in renders Amazon Pay in your payment form. When clicking the Amazon Pay button, the component redirects the shopper to an Amazon Pay hosted page where they select the details of the purchase before reviewing and confirming the order. This is supported from [Web Drop-in 4.1.0](/online-payments/release-notes?integration_type=web\&version=4.1.0). ## Requirements | Requirement | Description | | -------------------- | ------------------------------------------------------------------------------------------------------ | | **Integration type** | Make sure that you have built your [Web Drop-in integration](/online-payments/build-your-integration). | | **Setup steps** | Before you begin, [add Amazon Pay in your test Customer Area](/payment-methods/add-payment-methods). | ## Register for Amazon Pay Sign up for a merchant account on the Amazon Pay website. After the registration is complete, return to this page. Select the correct region for your account from the list below. * [EU Registration](https://pay.amazon.eu/signup) — For merchants with a legal entity in one of the following locations: Austria, Belgium, Cyprus, Denmark, France, Germany, Hungary, Ireland, Italy, Luxembourg, the Netherlands, Portugal, Spain, Sweden, or Switzerland. Select EUR as a currency in the registration page. * [UK Registration](https://pay.amazon.co.uk/signup) — For merchants with a legal entity in the United Kingdom. * [US Registration](https://pay.amazon.com/) - For merchants with a legal entity in the United States. ## Create an Amazon Pay Sandbox test buyer account Use Sandbox to conduct end-to-end tests of your integration before going live. For details, see [Amazon Pay Sandbox accounts](https://developer.amazon.com/docs/amazon-pay-checkout/amazon-pay-sandbox-accounts.html). After creating an Amazon Pay Sandbox account, return to this page. ## Get your PublicKeyId and give information to Adyen Amazon Pay uses asymmetric encryption to secure communication. Therefore, you need a public/private key pair. To set this up, you must have one of the following [user roles](/account/user-roles). * Merchant admin * Manage API Credentials 1. Log in to your [Customer Area](https://ca-test.adyen.com/) and select the merchant account you want to set up Amazon Pay for. 2. Select **Developers** > **API credentials**. Select the [web service user](/development-resources/api-credentials?query=Web%2Bservice%2Buser#new-credential) that you will use for Amazon Pay transactions. 3. In **Wallet payment methods** > **Amazon Pay certificate**, select **+ Add**. 4. Select **Generate key pair**. 5. Copy the the public key and send it to your Amazon Pay contact. 6. Receive the `publicKeyId` from your Amazon Pay contact. 7. Send the following to our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other): * `publicKeyId` * `amazonMerchantId`: You can find this in your Amazon Seller Central or ask your Amazon Pay contact for it. * `amazonStoreId`: You can find this in your Amazon Seller Central or ask your Amazon Pay contact for it.\ We configure Amazon Pay for you after receiving your information. Your Amazon `publicKeyId` is unique to a single web service user. You cannot use the same `publicKeyId` for multiple web service users. ## Import resources for v6 If you are using Web Drop-in v6, import the resources you need for Amazon Pay: ```js import { AdyenCheckout, AmazonPay} from '@adyen/adyen-web' ``` ## Show Amazon Pay in your payment page After you have finished configuring Amazon Pay, you can show the Amazon Pay button in your payment form: 1. Make a [/paymentMethods](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/post/paymentMethods) request with one of the supported combinations of [countryCode](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/post/paymentMethods__reqParam_countryCode) and [amount.currency](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/post/paymentMethods__reqParam_amount-currency). 2. When creating an instance of Drop-in, make sure you are adding an `amount` object containing the currency and value of the payment, in minor units. When the shopper clicks the Amazon Pay button, they are redirected to the Amazon website to log in and select the payment details. ### Drop-in configuration When creating an instance of Drop-in, you can also: * Configure the appearance of the Amazon Pay button. * Change `productType`. * Include additional data, such as address and merchant metadata. | **Parameter** | **Description** | **Default** | | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------- | | `buttonColor` | Color of the Amazon Pay button. Supported values: **Gold**, **LightGray**, and **DarkGray**. | **Gold** | | `deliverySpecifications` | Use the `deliverySpecifications` parameter to specify shipping restrictions for your shop, and prevent buyers from selecting unsupported addresses from their Amazon address book. See [address restriction samples](https://developer.amazon.com/docs/amazon-pay-checkout/address-restriction-samples.html) for examples of common use cases. Do not set this parameter if you are selling digital goods. In this case, set the `productType` parameter to **PayOnly**. | **{}** | | `environment` | requiredSet to **test**. Change this to **live** when you are ready to accept live payments. | **test** | | `locale` | Language used to render the button and text on Amazon Pay hosted pages. Please note that supported language(s) is dependent on the region that your Amazon Pay account was registered for. Supported values: **en\_GB**, **de\_DE**, **fr\_FR**, **it\_IT**, **es\_ES**. | **en\_GB** | | `merchantId` | Amazon Pay merchant account identifier. | | | `placement` | Placement of the Amazon Pay button on your website. Supported values: **Home**, **Product**, **Cart**, **Checkout**, **Other**. | **Cart** | | `productType` | Product type selected for checkout. Supported values: **PayAndShip** — Offer checkout using the shopper's Amazon wallet and address book. Select this product type if you sell physical goods that you ship to the address associated with the shopper's Amazon account. **PayOnly** — Offer checkout using only the shopper's Amazon wallet. Select this product type if you do not need the shopper's shipping details, as you are selling digital goods. | **PayAndShip** | | `publicKeyId` | The `publicKeyId` from [Step 3](#step-3). | | | `returnUrl` | requiredThe URL where the shopper will be redirected back to after they complete the selection of details from the Amazon hosted page. | | | `storeId` | Retrieve this value from Amazon Pay [Integration Central](https://sellercentral-europe.amazon.com/external-payments/amazon-pay/integration-central/lwa). | | | `chargePermissionType` | The type of charge permission requested. Supported values: **OneTime** — for a single payment. **Recurring** — for recurring payments. | **OneTime** | | [`recurringMetadata`](https://developer.amazon.com/docs/amazon-pay-api-v2/checkout-session.html#type-recurringmetadata) | How often the shopper will be charged using a recurring charge permission, for example monthly or yearly. Required for payments with `chargePermissionType` **Recurring**. Specify a frequency even if you expect ad hoc charges. See [Amazon Pay documentation](https://developer.amazon.com/docs/amazon-pay-api-v2/checkout-session.html#type-recurringmetadatafor) more information. | | Here's an example of the Amazon Pay Drop-in configuration for a payment of USD 30 once a month: ```js const dropin = checkout .create('dropin', { // ... paymentMethodsConfiguration: { amazonpay: { // Optional configuration for Amazon Pay productType: 'PayAndShip', merchantMetadata: { merchantReferenceId: 'Merchant-order-123', merchantStoreName: 'MyStore', noteToBuyer: 'Thank you for your order' }, chargePermissionType: 'Recurring', // For a recurring payment recurringMetadata: { // For a payment that happens once a month frequency: { unit: 'Month', value: '1' }, amount: { amount: '30' currencyCode: 'USD' } }, addressDetails: { name: 'Simon Hopper', addressLine1: 'Broadway 8-10', city: 'London', postalCode: 'SW1H 0BG', countryCode: 'GB', phoneNumber: '+44 203 936 4029' }, environment: 'test', returnUrl: 'https://example.com/process_payment' } } }) .mount('#dropin'); ``` ## Handle the redirect When the shopper confirms the payment, they are redirected back to the `returnUrl` with the `amazonCheckoutSessionId` attached to the URL. Use the `amazonCheckoutSessionId` to create an instance of the Amazon Pay Component to make the actual payment. 1. Create a DOM element for the Component, placing it where you want it to be rendered. At this point of the flow, the Component doesn't show anything. This page executes the logic of the payment and handles any additional shopper interaction. The Component uses this node, for example, in case a 3D Secure 2 challenge needs to be displayed. ```html
``` 2. Define a `handleOnSubmit` function to be passed to the Component configuration object as a value for the `onSubmit` parameter. The function should accept the `state.data` object from the Drop-in as an input, and trigger the backend function that you define, which executes the [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) API call. ```js onSubmit: (state, component) => { component.setStatus('loading'); // Merchant's function to make a payment return makePayment(state.data) .then(response => { component.setStatus('ready'); if (response.action) { // Handle additional action (3D Secure / redirect / other) component.handleAction(response.action); } else { // The merchant's function to show the final result or redirect to a final status page handleFinalResult(response); } }) .catch(error => { // Handle error; }); } ``` 3. Create an instance of the Amazon Pay Component and pass `amazonCheckoutSessionId`. Hide the **Order** button by setting `showOrderButton` to **false**. After the Component is mounted, trigger the `submit` function which should be defined in the Adyen Checkout constructor. ```js const amazonPayComponent = checkout .create('amazonpay', { amazonCheckoutSessionId: '...', showOrderButton: false }) .mount('#amazonpay_payment-container'); amazonPayOrder.submit(); ``` This will call the `onSubmit` event, which contains a `state.data` object. Pass the object to the server to [make a payment](#make-a-payment) and parse the result of the payment. ## Make a payment From your server, make a [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request, specifying the following parameters: * `paymentMethod`: The `state.data.paymentMethod` from the `onSubmit` event from your front end. * `returnUrl`: The URL where the shopper will be redirected back to after completing the payment. The URL should include the protocol: `http://` or `https://`. For example, `https://your-company.example.com/checkout/`. You can also include your own additional query parameters, for example, shopper ID or order reference number. #### curl ```bash curl https://checkout-test.adyen.com/v68/payments \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "amount": { "currency": "EUR", "value": 1000 }, "reference": "YOUR_ORDER_NUMBER", "paymentMethod": { "type": "amazonpay" }, "returnUrl": "https://your-company.example.com/checkout?shopperOrder=12xy..", "merchantAccount": "ADYEN_MERCHANT_ACCOUNT" }' ``` #### Java ```java // Adyen Java API Library v27.0.0 import com.adyen.Client; import com.adyen.enums.Environment; import com.adyen.model.checkout.*; import java.time.OffsetDateTime; import java.util.*; import com.adyen.model.RequestOptions; import com.adyen.service.checkout.*; // For the live environment, additionally include your liveEndpointUrlPrefix. Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Create the request object(s) Amount amount = new Amount() .currency("EUR") .value(1000L); AmazonPayDetails amazonPayDetails = new AmazonPayDetails() .type(AmazonPayDetails.TypeEnum.AMAZONPAY); PaymentRequest paymentRequest = new PaymentRequest() .reference("YOUR_ORDER_NUMBER") .amount(amount) .merchantAccount("ADYEN_MERCHANT_ACCOUNT") .paymentMethod(new CheckoutPaymentMethod(amazonPayDetails)) .returnUrl("https://your-company.example.com/checkout?shopperOrder=12xy.."); // Send the request PaymentsApi service = new PaymentsApi(client); PaymentResponse response = service.payments(paymentRequest, new RequestOptions().idempotencyKey("UUID")); ``` #### PHP ```php // Adyen PHP API Library v19.0.0 use Adyen\Client; use Adyen\Environment; use Adyen\Model\Checkout\Amount; use Adyen\Model\Checkout\CheckoutPaymentMethod; use Adyen\Model\Checkout\PaymentRequest; use Adyen\Service\Checkout\PaymentsApi; $client = new Client(); $client->setXApiKey("ADYEN_API_KEY"); // For the live environment, additionally include your liveEndpointUrlPrefix. $client->setEnvironment(Environment::TEST); // Create the request object(s) $amount = new Amount(); $amount ->setCurrency("EUR") ->setValue(1000); $checkoutPaymentMethod = new CheckoutPaymentMethod(); $checkoutPaymentMethod ->setType("amazonpay"); $paymentRequest = new PaymentRequest(); $paymentRequest ->setReference("YOUR_ORDER_NUMBER") ->setAmount($amount) ->setMerchantAccount("ADYEN_MERCHANT_ACCOUNT") ->setPaymentMethod($checkoutPaymentMethod) ->setReturnUrl("https://your-company.example.com/checkout?shopperOrder=12xy.."); $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new PaymentsApi($client); $response = $service->payments($paymentRequest, $requestOptions); ``` #### C\# ```cs // Adyen .net API Library v17.0.0 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.Checkout; using Adyen.Service.Checkout; // For the live environment, additionally include your liveEndpointUrlPrefix. var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Create the request object(s) Amount amount = new Amount { Currency = "EUR", Value = 1000 }; AmazonPayDetails amazonPayDetails = new AmazonPayDetails { Type = AmazonPayDetails.TypeEnum.Amazonpay }; PaymentRequest paymentRequest = new PaymentRequest { Reference = "YOUR_ORDER_NUMBER", Amount = amount, MerchantAccount = "ADYEN_MERCHANT_ACCOUNT", PaymentMethod = new CheckoutPaymentMethod(amazonPayDetails), ReturnUrl = "https://your-company.example.com/checkout?shopperOrder=12xy.." }; // Send the request var service = new PaymentsService(client); var response = service.Payments(paymentRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"}); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v18.0.0 // Require the parts of the module you want to use const { Client, CheckoutAPI } = require('@adyen/api-library'); // Initialize the client object // For the live environment, additionally include your liveEndpointUrlPrefix. const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object(s) const paymentRequest = { amount: { currency: "EUR", value: 1000 }, reference: "YOUR_ORDER_NUMBER", paymentMethod: { type: "amazonpay" }, returnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy..", merchantAccount: "ADYEN_MERCHANT_ACCOUNT" } // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` #### Go ```go // Adyen Go API Library v10.4.0 import ( "context" "github.com/adyen/adyen-go-api-library/v9/src/common" "github.com/adyen/adyen-go-api-library/v9/src/adyen" "github.com/adyen/adyen-go-api-library/v9/src/checkout" ) // For the live environment, additionally include your liveEndpointUrlPrefix. client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Create the request object(s) amount := checkout.Amount{ Currency: "EUR", Value: 1000, } amazonPayDetails := checkout.AmazonPayDetails{ Type: common.PtrString("amazonpay"), } paymentRequest := checkout.PaymentRequest{ Reference: "YOUR_ORDER_NUMBER", Amount: amount, MerchantAccount: "ADYEN_MERCHANT_ACCOUNT", PaymentMethod: checkout.AmazonPayDetailsAsCheckoutPaymentMethod(&amazonPayDetails), ReturnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy..", } // Send the request service := client.Checkout() req := service.PaymentsApi.PaymentsInput().IdempotencyKey("UUID").PaymentRequest(paymentRequest) res, httpRes, err := service.PaymentsApi.Payments(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v12.5.1 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" # For the live environment, additionally include your liveEndpointUrlPrefix. adyen.client.platform = "test" # The environment to use library in. # Create the request object(s) json_request = { "amount": { "currency": "EUR", "value": 1000 }, "reference": "YOUR_ORDER_NUMBER", "paymentMethod": { "type": "amazonpay" }, "returnUrl": "https://your-company.example.com/checkout?shopperOrder=12xy..", "merchantAccount": "ADYEN_MERCHANT_ACCOUNT" } # Send the request result = adyen.checkout.payments_api.payments(request=json_request, idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v9.5.1 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' # For the live environment, additionally include your liveEndpointUrlPrefix. adyen.env = :test # Set to "live" for live environment # Create the request object(s) request_body = { :amount => { :currency => 'EUR', :value => 1000 }, :reference => 'YOUR_ORDER_NUMBER', :paymentMethod => { :type => 'amazonpay' }, :returnUrl => 'https://your-company.example.com/checkout?shopperOrder=12xy..', :merchantAccount => 'ADYEN_MERCHANT_ACCOUNT' } # Send the request result = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' => 'UUID' }) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v18.0.0 // Require the parts of the module you want to use import { Client, CheckoutAPI, Types } from "@adyen/api-library"; // Initialize the client object // For the live environment, additionally include your liveEndpointUrlPrefix. const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object(s) const amount: Types.checkout.Amount = { currency: "EUR", value: 1000 }; const amazonPayDetails: Types.checkout.AmazonPayDetails = { type: Types.checkout.AmazonPayDetails.TypeEnum.Amazonpay }; const paymentRequest: Types.checkout.PaymentRequest = { reference: "YOUR_ORDER_NUMBER", amount: amount, merchantAccount: "ADYEN_MERCHANT_ACCOUNT", paymentMethod: amazonPayDetails, returnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy.." }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` The [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) response contains: * `pspReference`: Adyen's unique reference for the payment. * `resultCode`: Authorised **/payments response** ```json { "pspReference": "8815658961765250", "resultCode": "Authorised" } ``` Amazon Pay works with cards the shopper has previously stored with Amazon. Because the card is tokenized, the payment is categorized as shopper initiated Card On File. Amazon Pay payments are displayed with shopper interaction `ContAuth` in the Customer Area payment page. ### Handle the decline flow In case of a credit card decline due to card expiration or insufficient funds, redirect the shopper back to the Amazon Pay payment method selection page. You can do this by calling the `handleDeclineFlow` from the Amazon Pay Component. This flow lets you [recover from a declined payment](https://developer.amazon.com/docs/amazon-pay-api-v2/checkout-session.html?environmentSpecificKeys=true) as described in the Amazon Pay documentation. ```js onSubmit: async (state, component) => { try { const response = await makePayment(state.data); // Check the result code if (response.resultCode && checkPaymentResponse(response.resultCode)) { // Show successful message } else { // Handle decline flow amazonPayComponent.handleDeclineFlow(); } } catch (error) { // Fatal error } }, onError: (error) => { if (error.resultCode) { // Show payment failed message or start over the flow. } else { // Fatal error } } ``` ## Present the payment result Use the `resultCode` that you received in the [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) response to present the payment result to your shopper. The `resultCode` values you can receive for Amazon Pay are: | resultCode | Description | Action to take | | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Authorised** | The payment was successful. | Inform the shopper that the payment has been successful. If you are using [manual capture](/online-payments/capture#manual-capture), you also need to [capture](/online-payments/capture) the payment. | | **Cancelled** | The shopper cancelled the payment. | Ask the shopper whether they want to continue with the order, or ask them to select a different payment method. | | **Error** | There was an error when the payment was being processed. For more information, check the [`refusalReason` ](/development-resources/refusal-reasons)field. | Inform the shopper that there was an error processing their payment. | | **Refused** | The payment was refused. For more information, check the [`refusalReason` ](/development-resources/refusal-reasons)field. | Redirect the shopper back to the payment page and ask them to try the payment again using a different card. For more information on how to do this, check [Amazon Pay's documentation](https://developer.amazon.com/docs/amazon-pay-checkout/introduction.html). | Additional `resultCode` values are possible in case of the 3D Secure authentication flow. For more information, refer to [Result codes](/online-payments/payment-result-codes). []()If the shopper failed to return to your website or app, wait for webhooks to know the outcome of the payment. The webhooks you can receive for Amazon Pay are: | eventCode | success field | Description | Action to take | | ----------------- | ------------- | ----------------------------------------------- | ----------------------------------------------------------------------------------- | | **AUTHORISATION** | **false** | The transaction failed. | Cancel the order and inform the shopper that the payment failed. | | **AUTHORISATION** | **true** | The shopper successfully completed the payment. | Inform the shopper that the payment has been successful and proceed with the order. | | **OFFER\_CLOSED** | **true** | The shopper did not complete the payment. | Cancel the order and inform the shopper that the payment timed out. | ### Optional. Sign out from Amazon After the transaction is finished, and the result is shown to the shopper, display a button to let them sign out from the Amazon account. 1. Create a DOM element for the **Sign out** button, placing it where you want it to be rendered: ```html ``` 2. Create an instance of the Amazon Pay Component and pass the `amazonCheckoutSessionId` along with `showSignOutButton` set to **true**. ```js const amazonPayComponent = checkout .create('amazonpay', { amazonCheckoutSessionId: '...', showSignOutButton: true }) .mount('#amazonpay_signout'); ``` ## Recurring payments We support recurring transactions for Amazon Pay. To make recurring payments, you need to: 1. [Create a shopper token](#create-a-token). 2. [Use the token to make future payments for the shopper](#make-payment-with-token). ### Create a token To create a token, include in your [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request: * `storePaymentMethod`: **true** * [shopperReference](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperReference): Your unique identifier for the shopper. When the payment has been settled, you receive a [recurring.token.created](https://docs.adyen.com/api-explorer/Tokenization-webhooks/latest/post/recurring.token.created) [webhook](/development-resources/webhooks) containing: * `type`: **recurring.token.created** * `shopperReference`: your unique identifier for the shopper. * `eventId`: the `pspReference` of the initial payment. * `storedPaymentMethodId`: the token that you need to make recurring payments for this shopper. Make sure that your server is able to receive the [Recurring tokens life cycle events](/development-resources/webhooks/webhook-types/#other-webhooks) webhook. You can [set up this webhook in your Customer Area](/development-resources/webhooks/#set-up-webhooks-in-your-customer-area). ### Make a payment with a token To make a payment with the token, include in your [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request: * `paymentMethod.storedPaymentMethodId`: The `storedPaymentMethodId` from the [recurring.token.created](https://docs.adyen.com/api-explorer/Tokenization-webhooks/latest/post/recurring.token.created) webhook. You can also get this value using the [/listRecurringDetails](https://docs.adyen.com/api-explorer/Recurring/latest/post/listRecurringDetails) endpoint. * `shopperReference`: The unique shopper identifier that you specified when creating the token. * `shopperInteraction`: **ContAuth**. * `recurringProcessingModel`: **Subscription** or **UnscheduledCardOnFile**. For more information about the `shopperInteraction` and `recurringProcessingModel` fields, refer to [Tokenization](/online-payments/tokenization/). #### curl ```bash curl https://checkout-test.adyen.com/v72/payments \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "amount":{ "value":1000, "currency":"EUR" }, "paymentMethod":{ "type":"amazonpay", "storedPaymentMethodId":"7219687191761347" }, "reference":"YOUR_ORDER_NUMBER", "merchantAccount":"YOUR_MERCHANT_ACCOUNT", "shopperReference":"YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j", "shopperInteraction":"ContAuth", "recurringProcessingModel": "Subscription" }' ``` #### Java ```java // Set ADYEN_API_KEY with the API key from the Customer Area. // Change to Environment.LIVE and add the Live URL prefix when you are ready to accept live payments. Client client = new Client("ADYEN_API_KEY", Environment.TEST); Checkout checkout = new Checkout(client); PaymentsRequest paymentsRequest = new PaymentsRequest(); String merchantAccount = "YOUR_MERCHANT_ACCOUNT"; paymentsRequest.setMerchantAccount(merchantAccount); Amount amount = new Amount(); amount.setCurrency("EUR"); amount.setValue(15000L); paymentsRequest.setAmount(amount); DefaultPaymentMethodDetails paymentMethodDetails = new DefaultPaymentMethodDetails(); paymentMethodDetails.setRecurringDetailReference("7219687191761347"); paymentMethodDetails.setType("amazonpay"); paymentsRequest.setPaymentMethod(paymentMethodDetails); paymentsRequest.setReference("YOUR_ORDER_NUMBER"); paymentsRequest.setReturnUrl("https://your-company.example.com/checkout?shopperOrder=12xy.."); paymentsRequest.setShopperInteraction("ContAuth"); paymentsRequest.setRecurringProcessingModel("Subscription"); PaymentsResponse paymentsResponse = checkout.payments(paymentsRequest); ``` #### PHP ```php // Set your X-API-KEY with the API key from the Customer Area. $client = new \Adyen\Client(); $client->setXApiKey("ADYEN_API_KEY"); $service = new \Adyen\Service\Checkout($client); $params = array( "amount" => array( "currency" => "EUR", "value" => 1000 ), "reference" => "YOUR_ORDER_NUMBER", "paymentMethod" => array( "type" => "amazonpay", "storedPaymentMethodId" => "7219687191761347" ), "returnUrl" => "https://your-company.example.com/checkout?shopperOrder=12xy..", "shopperReference" => "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j", "recurringProcessingModel" => "Subscription", "shopperInteraction" => "ContAuth", "merchantAccount" => "YOUR_MERCHANT_ACCOUNT" ); $result = $service->payments($params); ``` #### C\# ```cs // Set your X-API-KEY with the API key from the Customer Area. var client = new Client ("ADYEN_API_KEY", Environment.Test); var checkout = new Checkout(client); var amount = new Adyen.Model.Checkout.Amount("EUR", 1000); var details = new Adyen.Model.Checkout.DefaultPaymentMethodDetails{ Type = "amazonpay", StoredPaymentMethodId = "7219687191761347" }; var paymentsRequest = new Adyen.Model.Checkout.PaymentRequest { Reference = "YOUR_ORDER_NUMBER", Amount = amount, ReturnUrl = @"https://your-company.example.com/checkout?shopperOrder=12xy..", MerchantAccount = "YOUR_MERCHANT_ACCOUNT", ShopperReference = "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j", RecurringProcessingModel = Adyen.Model.Checkout.PaymentRequest.RecurringProcessingModelEnum.Subscription, ShopperInteraction = Adyen.Model.Checkout.PaymentRequest.ShopperInteractionEnum.ContAuth, PaymentMethod = details }; var paymentResponse = checkout.Payments(paymentsRequest); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v16.1.0 // Require the parts of the module you want to use const { Client, CheckoutAPI } = require('@adyen/api-library'); // Initialize the client object const client = new Client({apiKey: "YOUR_X_API_KEY", environment: "TEST"}); // Create the request object const paymentRequest = { amount: { value: 1000, currency: "EUR" }, paymentMethod: { type: "amazonpay", storedPaymentMethodId: "7219687191761347" }, reference: "YOUR_ORDER_NUMBER", merchantAccount: "YOUR_MERCHANT_ACCOUNT", shopperReference: "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j", shopperInteraction: "ContAuth", recurringProcessingModel: "Subscription" } // Make the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` #### Python ```py # Adyen Python API Library v12.0.0 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "YOUR_X_API_KEY" adyen.client.platform = "test" # The environment to use library in. json_request = { "amount": { "value": 1000, "currency": "EUR" }, "paymentMethod": { "type": "amazonpay", "storedPaymentMethodId": "7219687191761347" }, "reference": "YOUR_ORDER_NUMBER", "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "shopperReference": "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j", "shopperInteraction": "ContAuth", "recurringProcessingModel": "Subscription" } result = adyen.checkout.payments_api.payments(request=json_request, idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v9.1.0 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'YOUR_X_API_KEY' adyen.env = :test # Set to "live" for live environment request_body = { :amount => { :value => 1000, :currency => 'EUR' }, :paymentMethod => { :type => 'amazonpay', :storedPaymentMethodId => '7219687191761347' }, :reference => 'YOUR_ORDER_NUMBER', :merchantAccount => 'YOUR_MERCHANT_ACCOUNT', :shopperReference => 'YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j', :shopperInteraction => 'ContAuth', :recurringProcessingModel => 'Subscription' } result = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' => 'UUID' }) ``` ## Test and go live To test Amazon Pay, you must follow the [Amazon Pay testing guidelines](https://developer.amazon.com/docs/amazon-pay-checkout/test-your-integration.html). You can check the status of an Amazon Pay test payment in your [Customer Area](https://ca-test.adyen.com/) > **Transactions** > **Payments**. Before you can accept live Amazon Pay payments, you need to [submit a request for Amazon Pay](/payment-methods/add-payment-methods) in your [live Customer Area](https://ca-live.adyen.com/). ## See also * [Web Drop-in integration guide](/online-payments/drop-in-web) * [Amazon Pay error codes](/development-resources/error-codes#amazon-pay-error-codes)