Skip to main content
Postman collection Implementation examples
Java Spring
.NET
Node.js
Creating payment links through the API allows you to accept most payment methods, including buy now, pay later payment methods such as Klarna and Afterpay. Using payment links to accept payments works as follows:
  1. Create a payment link.
  2. Send the payment link to your shopper.
  3. Get updates about the payment.
On this page, you’ll also learn how to implement additional use cases such as:

Requirements

Before you begin to integrate, make sure you have followed the Get started with Adyen guide to:
  • Get an overview of the steps needed to accept live payments.
  • Create your test account.
After you have created your test account:

Generate your API key

  1. Log in to your Customer Area and select your Company account.
  2. Go to Developers > API credentials.
  3. Select the Payments or Platforms tab, depending on your integration type.
  4. Select the credential username.
  5. Under Server settings > Authentication select the API key tab.
  6. Select Generate API key.
  7. Select the copy icon **and store your API key securely in your system. You cannot copy the API key again after you leave the page.
  8. Select Save changes.

Set up webhooks

Webhooks allow you to get updates about the payment after you have sent the payment link to your shopper. If you haven’t done so already, set up webhooks, and make sure that your server can process and accept webhooks.

Add payment methods to your account

If you haven’t done so already, add payment methods to your merchant account. To see which payment methods are supported for Pay by Link, refer to Supported payment methods.
  1. Log in to your Customer Area.
  2. Switch to your merchant account.
  3. Go to Settings > Payment methods.
  4. Select Add payment methods.
  5. Start entering the name of the payment method, then select it from the drop-down list.
  6. Select Submit.
Make a POST /paymentLinks request specifying the following: You can also include other parameters, for example shopperLocale to specify the language of the payment page, expiresAt to change the expiry date of the payment link, or description to add a description for the product. If these are not provided, the payment page will be rendered in the language of the shopper’s browser locale, without a description, and with a 24-hour expiry. In this example, we’ll show you how you can create a payment link for a shopper in the Netherlands for a purchase amount of EUR 42:
You receive a response containing the following:
  • id: the payment link ID.
  • url: the payment link that you should send to your shopper.
  • expiresAt: date and time when the payment link expires.
Response
Use the url from the /paymentLinks response to redirect your shopper to the payment link. Starting November 1, 2025, you cannot embed payment links in an iframe. If you are currently using payment links in an iframe, update your integration to comply. Send the url to your shopper. When the shopper selects the link, they are redirected to an Adyen-hosted payment page. The shopper is presented with the payment methods available for the amount and countryCode specified in the request.

Step 3: Get updates about the payment

First, wait for the AUTHORISATION webhook to receive the result of the payment, as well as the payment link ID. When you have the payment link ID, you can make a GET /paymentLinks/{linkId} request to get details about the payment link. You can also view payment links in your Customer Area. Currently, the Payment Links page in the Customer Area only shows links that are created in the EU. For links created in other regions, you can use the id you received in the /paymentLinks response to navigate to the payment link details page, with the following format:
We keep payment link details for three months. If it was more than three months ago that a payment link was created, the details are no longer available.

AUTHORISATION webhook

The AUTHORISATION webhook contains:
  • additionalData.paymentLinkId: Use this to match the payment to the payment link. For our example, this matches the payment link ID PL50C5F751CED39G71.
  • pspReference: Unique identifier for the payment.
  • success: The result of the transaction.
AUTHORISATION webhook
To get the details of a specific payment link, send a GET /paymentLinks/{linkId} request. Let’s use our example from the previous section for a payment link with ID PL50C5F751CED39G71. Get payment link details
The response returns the payment link details, including the amount and the status. If the link is not expired and has not been paid, the status is active. Else, the status is completed or expired. The status can also be paymentPending if the payment has an asynchronous flow and the shopper hasn’t yet completed the payment. Response
In some cases, you may want to create a reusable link. For example, if you want to accept donations for a fixed amount from multiple shoppers, or sell event tickets. To do this, set reusable to true in your POST /paymentLinks request. The following example shows how to create a reusable payment link to accept donations for the amount of USD 8.50 from shoppers in the United States: Create a reusable payment link

Tokenize your shopper’s payment details

You can use the Pay by Link API to create a payment link that will tokenize and store your shopper’s card details. Your /paymentLinks request must include a recurringProcessingModel to indicate how you want to use the token:

Tokenize for future one-off payments

You should always ask for your customer’s consent before tokenizing their card for future payments. You can use the Pay by Link API to create a payment link that will tokenize and store your shopper’s card details for future one-off payments. The next time the same shopper makes a purchase, their stored card details will be presented on the payment page.
  1. Send the following in your POST /paymentLinks request:
    • A unique shopperReference of at least three characters. Your reference must not include personally identifiable information (PII), like name or email address.
    • storePaymentMethodMode set to askForConsent to allow the shopper to decide whether to store the details. If you already have the shopper’s consent, set this parameter to enabled.
    • recurringProcessingModel set to CardOnFile.
    Here’s an example of how you can create a payment link for a shopper with shopperReference ShopperID-A16728. Create a payment link to save card details

    curl

    Java

    PHP

    C#

    NodeJS (JavaScript)

    Go

    Python

    Ruby

    NodeJS (TypeScript)

    The shopper’s card details will be tokenized after they make a successful payment.
  2. When the shopper returns for their next purchase, send the same shopperReference from the first request, and set recurringProcessingModel to CardOnFile in your POST /paymentLinks request. Here’s an example of how you can create a payment link for the same shopper with shopperReference ShopperID-A16728. Create a payment link that shows stored card details

    curl

    Java

    PHP

    C#

    NodeJS (JavaScript)

    Go

    Python

    Ruby

    NodeJS (TypeScript)

Tokenize for subscriptions

You should always ask for your customer’s consent before tokenizing their card for future payments. You can use the Pay by Link API to create a payment link that will tokenize and store your shopper’s card details for recurring payments.
  1. Send the following in your POST /paymentLinks request:
    • A unique shopperReference of at least three characters. Your reference must not include personally identifiable information (PII), like name or email address.
    • storePaymentMethodMode set to askForConsent to allow the shopper to decide whether to store the details. If you already have the shopper’s consent, set this parameter to enabled.
    • recurringProcessingModel set to Subscription.
    • The payment amount, or if you only want to tokenize the shopper’s payment details without charging them, set the amount.value to 0. This is called a zero-value authorisation. Instead of a Pay button, your shoppers will see a Confirm preauthorization button on the payment page.
    Here is an example of how you can create a payment link to tokenize and store payment details for a subscription, for a shopper with shopperReference Shopper-B7183. Create a payment link to tokenize for subscription

    curl

    Java

    PHP

    C#

    NodeJS (JavaScript)

    Go

    Python

    Ruby

    NodeJS (TypeScript)

  2. After the shopper completes the payment or the preauthorization, make a POST /paymentMethods request to get the shopper’s tokenized payment details.
  3. Send the token when you make subsequent subscription payments with a POST /payments request.

Tokenize for unscheduled recurring payments

You should always ask for your customer’s consent before tokenizing their card for future payments. You can use the Pay by Link API to create a payment link that will tokenize and store your shopper’s card details for recurring payments on a non-fixed schedule.
  1. Send the following in your POST /paymentLinks request:
    • A unique shopperReference of at least three characters. Your reference must not include personally identifiable information (PII), like name or email address.
    • storePaymentMethodMode set to askForConsent to allow the shopper to decide whether to store the details. If you already have the shopper’s consent, set this parameter to enabled.
    • recurringProcessingModel set to UnscheduledCardOnFile.
    • The payment amount, or if you only want to tokenize the shopper’s payment details without charging them, set the amount.value to 0. This is called a zero-value authorisation. Instead of a Pay button, your shoppers will see a Confirm preauthorization button on the payment page.
    Here is an example of how you can create a payment link to tokenize and store payment details for automatic top-ups, for a shopper with shopperReference Shopper-C5250. Create a payment link to tokenize for automatic top-ups

    curl

    Java

    PHP

    C#

    NodeJS (JavaScript)

    Go

    Python

    Ruby

    NodeJS (TypeScript)

  2. After the shopper completes the payment or the preauthorization, make a POST /paymentMethods request to get the shopper’s tokenized payment details.
  3. Send the token when you make subsequent recurring payments with a POST /payments request.

Provide additional information

Some payment methods, such as buy now, pay later payment methods, require additional information about the purchased product (lineItems) or the shopper (for example, shopperEmail). If you want to create a payment link that can support these payment methods, you need to make sure that you provide this information.

Provide product information

If a payment method requires lineItems, you will need to collect this information, and include it in your POST /paymentLinks request. The following example shows how to create a payment link that can support 3x 4x Oney (FR, ES) . Create payment link with lineItems

Provide shopper information

For shopper information such as name, email, or address, you can either:
The following example shows how to create a payment link that can support Klarna, and ask the shopper to fill in the required information themselves:Create payment link with required shopper fields