# Amazon Pay Module

https://docs.wisecp.com/fr/amazon-pay-module

Connect Amazon Pay so clients can pay with their Amazon account and you can track payments and refunds in WISECP.

## Reaching the Screen

Go to **Settings → Financial → Payment Gateways → All Modules** and click **Amazon Pay**: `{admin}/modules/payment?module=AmazonPay`

## What Is on the Screen

The form contains account credentials, region, language and a return address. The Amazon Pay button opens Amazon's payment page. This module uses Checkout v2 for one-time payments with immediate capture.

WISECP card storage, automatic payment, subscriptions, installment selection and separate authorization/capture are unavailable. Payment methods saved at Amazon remain with Amazon.

## Before You Configure It

Register an Amazon Pay merchant account for your supported business region and complete its approval. A developer account permits sandbox testing. Use HTTPS and create a sandbox buyer account through the [official setup guide](https://developer.amazon.com/docs/amazon-pay-checkout/get-set-up-for-integration.html).

Use USD for the United States or JPY for Japan. Europe uses an EUR ledger; the United Kingdom uses GBP. Approved EUR/GBP accounts can charge AUD, GBP, DKK, EUR, HKD, JPY, NZD, NOK, ZAR, SEK, CHF or USD.

The current module sends the invoice currency without applying the shared conversion setting. Create invoices in a supported currency; TRY is unavailable. Check the currency and rounded amount, particularly whole-yen JPY payments.

## Fields

- **Merchant ID**: Required; empty initially. Your merchant identifier from Seller Central, Settings → Account Info.
- **Public Key ID**: Required; empty initially. SANDBOX- or LIVE- selects the environment, overriding Test Mode.
- **Private Key**: Required; empty initially. Paste the complete PEM private key belonging to that Public Key ID, including its header and footer.
- **Store ID**: Required; empty initially. The store's client ID from Integration Central, beginning with amzn1.application-oa2-client.
- **Region**: Required; defaults to United States (USD). Match the merchant account: United States, Europe, United Kingdom or Japan.
- **Checkout Language**: Optional; defaults to Automatic. US accepts English; Japan accepts Japanese. Europe/UK accept English, German, French, Italian and Spanish. Unsupported choices use the region default.
- **Test Mode**: Off initially. This switch selects sandbox only for older key IDs without SANDBOX-/LIVE- prefixes.
- **Return URL**: Generated and required; cannot be edited here. Copy the complete HTTPS address to Amazon's allowed return URLs.

**Status**, commission, amount limits and country lists follow [Payment Modules](https://docs.wisecp.com/en/payment-modules). Generated **Callback URL**, **Success URL** and **Failed URL** are not credential fields.

## Tasks

### Set Up the Account

1. In Seller Central, open **Integration Central** and choose the sandbox marketplace. Select **Self-developed** and the one-time payment option, then click **Get instructions**.
2. Under **API keys**, click **Create keys**. Choose **Generate API credentials**, name the key and click **Create keys**. Secure the downloaded PEM file.
3. Enter the four credentials and matching region in WISECP's Amazon Pay form. Enable **Status** and click **Save Changes**.
4. Open **Payment Gateways → Initial → Enabled Module Selection**, select Amazon Pay and click **Save Changes**. It becomes available within its limits.

### Register the Website and Return

In Integration Central, add the live checkout website to **JavaScript Origins** and WISECP's **Return URL** to the allowed return addresses. Include the protocol and any custom port. Amazon may review a new origin for up to 48 hours.

This module signs the payment request and reads the returned session and charge through Amazon's API. It has no separate IPN/webhook receiver. Do not register Return URL as an Amazon SNS notification endpoint.

### Test and Enable Live Payments

1. Open an unpaid test invoice as its client, select Amazon Pay and click **Pay Now**. Click the Amazon Pay button and use the sandbox buyer.
2. Test success, cancellation and interrupted return. Compare the Amazon charge ID, amount and currency with the invoice's payment record.
3. Check pending results in Seller Central before retrying. There is no connection-test button or background IPN recovery in this module.
4. After account approval and successful tests, enter matching LIVE credentials and click **Save Changes**. The LIVE prefix enables real payments even if Test Mode remains selected.

### Refund a Payment

1. Open the paid invoice at `{admin}/invoices/detail?id={invoice}`.
2. Under **Summary → Change Status**, choose **Refunded** and **Refund via payment gateway**. Click **Update Status**.
3. WISECP requests the invoice's recorded share of the Amazon charge, including payments covering several invoices. If that share cannot be found, arrange the refund in Seller Central.
4. Confirm the final refund in Seller Central. An accepted request can still be RefundInitiated; WISECP does not later synchronize its completion.

## Things to Watch

> **A Started Transfer Is Not Final Settlement**
> 
> The module accepts Captured and CaptureInitiated as payment success. A charge lookup failure leaves payment waiting. Check Amazon's final result before fulfilling an uncertain payment or charging again.

> **Keep the Account Keys Available**
> 
> Do not replace the account credentials while old payments still need refunds. A full invoice refund differs from a custom partial refund; handle custom amounts in Seller Central and reconcile both records.

## Required Privileges

Settings require **Modules → Payment Gateways** (`MODULES_PAYMENT_SETTINGS`). Refunds require **Billing → Edit** (`INVOICES_OPERATION`) and the corresponding Seller Central access.

## Related Articles

- [Payment Modules](https://docs.wisecp.com/en/payment-modules)
- [Invoice Detail Overview](https://docs.wisecp.com/en/invoice-detail-overview)
- [Amazon Pay Multi-currency](https://developer.amazon.com/docs/amazon-pay-checkout/multi-currency-integration.html)
- [Amazon Pay Refund States](https://developer.amazon.com/docs/amazon-pay-api-v2/refund.html)
