No momento, esta página não está disponível em português
Payment-method icon

Amazon Pay for API-only

Add Amazon Pay to an existing API-only integration.

These instructions explain how to add Amazon Pay to your existing API only integration.

Requirements

Requirement Description
Integration type Make sure that you have built an API-only integration.
Setup steps Before you begin, add Amazon Pay in your test Customer Area.

Prepare your integration

Before starting your Amazon Pay integration:

  1. Register with Amazon for an Amazon Pay account.
  2. Follow the steps on Amazon Pay's documentation to integrate with Amazon Pay.
  3. Check if your payments are affected by PSD2. If your payments are affected, implement 3D Secure authentication to comply with PSD2.

Build your payment form for Amazon Pay

Show Amazon Pay as an available payment method in countries/regions where Amazon Pay is supported. When the shopper selects Amazon Pay, they are presented with the payment form.

We provide logos for Amazon Pay which you can use on your payment form. For more information, refer to Downloading logos.

You can also submit a /paymentMethods request specifying:

  • countryCode: Countries/regions where Amazon Pay is supported. For example, NL.
  • amount.currency: You can only accept payments in the currency that you used when you registered with Amazon Pay. For example, EUR.

In the response, you receive paymentMethod.type: amazonpay.

Make a payment

Refer to Amazon Pay's documentation to integrate with Amazon Pay.

  1. Create a checkout session and follow all subsequent steps as described in Amazon Pay's documentation.
  2. Make a Get Checkout Session call to get the  amazonPayToken from the response.
  3. From your server, make a /payments request, providing:

    • paymentMethod.type: amazonpay
    • paymentMethod.amazonPayToken: This is the amazonPayToken that you obtained from the Get Checkout Session response.
    • browserInfo: Required if you are implementing 3D Secure. The shopper's browser information.

If you are implementing native 3D Secure, you also need to include other additional parameters in your request.

The following example shows how to make a payment request for Amazon Pay if you are not implementing 3D Secure.

The /payments response depends on whether the transaction was routed to 3D Secure. With 3D Secure you receive an action object, and need to handle the corresponding 3D Secure flow.

Without 3D Secure, the /payments response contains:

  • pspReference: Adyen's unique reference for the payment.
  • resultCode: Authorised

Present the payment result

Use the resultCode that you received in the /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, you also need to 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 field. Inform the shopper that there was an error processing their payment.
Refused The payment was refused. For more information, check the refusalReason 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.

Additional resultCode values are possible in case of the 3D Secure authentication flow. For more information, refer to 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.

Recurring payments

Make sure that you have your Amazon Pay integration set up for recurring payments. For details of how to do this, see Amazon Pay's documentation.

We support recurring transactions for Amazon Pay. To make recurring payments, you need to:

  1. Create a shopper token.
  2. Use the token to make future payments for the shopper.

Create a token

To create a token, include in your /payments request:

  • storePaymentMethod: true
  • shopperReference: Your unique identifier for the shopper.

When the payment has been settled, you receive a webhook containing:

  • eventCode: RECURRING_CONTRACT
  • originalReference: The pspReference of the initial payment.
  • pspReference: This is the token that you need to make recurring payments for this shopper.

Make sure that your server is able to receive RECURRING_CONTRACT as part of your standard webhooks. You can enable the RECURRING_CONTRACT event code in the webhook settings page.

Make a payment with a token

To make a payment with the token, include in your /payments request:

  • paymentMethod.storedPaymentMethodId: The pspReference from the RECURRING_CONTRACT.

    You can also get this value using the /listRecurringDetails endpoint.

  • shopperReference: The unique shopper identifier that you specified when creating the token.

  • shopperInteractionContAuth.

  • recurringProcessingModel: Subscription or UnscheduledCardOnFile.

For more information about the shopperInteraction and recurringProcessingModel fields, refer to Tokenization.

Test and go live

To test Amazon Pay, you must follow the Amazon Pay testing guidelines.

You can check the status of an Amazon Pay test payment in your Customer Area > Transactions > Payments.

Before you can accept live Amazon Pay payments, you need to submit a request for Amazon Pay in your live Customer Area.

For more information, see Amazon Pay's test environment setup.

See also