# Adyen Module

https://docs.wisecp.com/en/adyen-module

Take payments through Adyen, where the client pays on Adyen's own page and the card can be kept for later renewals.

## Reaching the Screen

Go to **Settings → Financial → Payment Gateways**, open **All Modules** and click the Adyen card: `{admin}/modules/payment?module=Adyen`

Tick **Status** and save to list the method on the payment step. Use [Payment Gateways](https://docs.wisecp.com/en/payment-modules) to order the methods clients see.

## What Is on the Screen

The card holds your Adyen credentials, the card-storage settings and the shared gateway settings.

Adyen creates a payment link for every order. The client sees a short panel inside checkout and opens Adyen's page from there, so card details never reach your site. Adyen then reports the result to the address in **Callback URL**.

A stored card can be charged later without the client, which is how renewals are paid. Subscriptions and installments are not supported: Adyen keeps no agreement of its own, so repeat charges run on the stored card.

## Before You Configure It

- An Adyen account with a merchant account you can take payments on. Test and live are separate environments with separate credentials.
- An API key in the same environment, with access to your merchant account. Enable its payment methods and Pay by Link terms; card storage also needs recurring-payment permissions.
- A currency Adyen accepts for that merchant account. Fill in **Converting Currency** when your prices are in another one.
- To keep cards for renewals, select Adyen as the card storage provider in [Payment Gateways](https://docs.wisecp.com/en/payment-modules).

## Fields

- **Status**: Turns the module on. While it is off the other fields stay locked and clients are never offered the method.
- **Environment**: Test or Live. Test collects nothing. Live also needs the prefix below.
- **API Key**: Required. The key Adyen sends every request with.
- **Merchant Account**: Required. The merchant account the payment links are created for.
- **Live URL Prefix**: Required in live mode only. Your own live address prefix, in the form `1797a841fbb37ca7-AdyenDemo`.
- **Webhook HMAC Key**: Required for notifications. Missing or invalid signatures are refused; the key must belong to the selected environment.
- **Card Storage**: Whether Adyen's page may keep the card: ask the shopper for consent, always store, or never store. Default: ask for consent.
- **Recurring Processing Model**: What later charges on a stored card are declared as. Use Subscription for a fixed schedule and UnscheduledCardOnFile for varying dates. Default: UnscheduledCardOnFile.
- **Shopper Reference Prefix**: Groups stored cards per client at Adyen. Change it only when several installs share one merchant account. Default: WCP.
- **Payment Link Lifetime (hours)**: How long a payment link stays payable. Default: 24 hours.

Commission, converting currency, accepted amount range and country lists behave the same on every gateway; see [Payment Gateways](https://docs.wisecp.com/en/payment-modules). **Callback URL**, **Success URL** and **Failed URL** cannot be edited; copy the callback address with the icon at the end of the field.

## Tasks

### Connect your Adyen account

1. In your Adyen Customer Area open **Developers → API credentials**, pick the credential and create an API key. It is shown once, so copy it there and then.
2. Open the Adyen card under **All Modules** and tick **Status**.
3. Set **Environment** to Test, then fill in **API Key** and **Merchant Account**.
4. Click **Save Changes**. The method now appears on the payment step.

### Register the notification address

1. Copy the address in **Callback URL** on the module card.
2. In your Customer Area open **Developers → Webhooks**, click **Create new webhook** and choose the standard webhook.
3. Paste the copied address as the server URL. Under the security settings generate an HMAC key and copy it.
4. Save the webhook and enter its key in **Webhook HMAC Key**, then click **Save Changes**. The module processes `AUTHORISATION`, `REFUND`, `REFUND_FAILED` and `REFUNDED_REVERSED`.

### Run a test payment

1. Place a small order as a client and choose Adyen on the payment step.
2. Click **Continue to Adyen** and pay with one of Adyen's test cards.
3. You return to the site. The invoice is marked as paid and the order is activated.

### Switch to live

1. Create a new API key in your live Customer Area: keys are never shared between environments.
2. Open **Developers → API URLs** there and copy the prefix.
3. Set **Environment** to Live, fill in **API Key** and **Live URL Prefix**, and save.
4. Create the webhook again in the live Customer Area and paste its HMAC key. Repeat the test with a real low-value payment.

### Offer stored cards and automatic payment

1. In **Payment Gateways → Initial Settings**, choose Adyen under **Card Storage Module** and click **Save Changes**.
2. Choose how the card is kept in **Card Storage** and how later charges are declared in **Recurring Processing Model**.
3. Click **Save Changes**. Clients can add cards from their accounts and select **Turn On Auto-Pay** from the card menu under **Saved Cards**.

### Refund a payment

1. Open the invoice from [Invoice Detail](https://docs.wisecp.com/en/invoice-detail-overview).
2. Under **Summary → Change Status**, select **Refunded** and **Refund via payment gateway**. Click **Update Status**.
3. Adyen accepts the request straight away, and the money leaves a few days later. The outcome arrives as a refund notification.

## Things to Watch

> **Notifications need the HMAC key**
> 
> A missing or wrong **Webhook HMAC Key** prevents notification verification. The client return can confirm payment separately, but the client may not return. Keep webhooks configured for payment, refund and saved-card updates.

> **Test and live never mix**
> 
> A test key collects no money, and a live key refuses test traffic. In live mode a missing **Live URL Prefix** stops every request before it reaches Adyen. Change the environment, the key and the prefix together.

> **Choose how new cards are stored**
> 
> **Never store** prevents new cards being saved from payment links; it does not remove existing saved cards. **Always store** saves without asking on that page. Choose the consent option when the client must approve storage.

## Required Privileges

**Payment Module Settings** (`MODULES_PAYMENT_SETTINGS`) is required. Invoice refunds also require `INVOICES_OPERATION`.

## Related Articles

- [Payment Gateways](https://docs.wisecp.com/en/payment-modules)
- [Invoice Detail](https://docs.wisecp.com/en/invoice-detail-overview)
