- Create a reusable payment link.
- Tokenize your shopper’s payment details for future one-off payments or for subscription payments.
- Provide additional information about the product or the shopper. This is required for some payment methods, for example buy now, pay later payment methods.
- Force the expiry of a payment link, for example if you sent a new payment link to your shopper.
- Customize the payment methods, style, and language shown on the payment page.
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.
- Add your terms and conditions to the Pay by Link payment page.
- Generate your API key for creating payment links.
- Set up webhooks to keep track of the payment result.
- Add payment methods to your account.
Generate your API key
- Log in to your Customer Area and select your Company account.
- Go to Developers > API credentials.
- Select the Payments or Platforms tab, depending on your integration type.
- Select the credential username.
- Under Server settings > Authentication select the API key tab.
- Select Generate API key.
- 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.
- 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.- Log in to your Customer Area.
- Switch to your merchant account.
- Go to Settings > Payment methods.
- Select Add payment methods.
- Start entering the name of the payment method, then select it from the drop-down list.
- Select Submit.
Step 1: Create a payment link
Make a POST /paymentLinks request specifying the following:- merchantAccount: the name of your merchant account.
- reference: your identifier for the transaction.
- amount: the
currencyandvaluein minor units.
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:
curl https://checkout-test.adyen.com/v72/paymentLinks \
-H 'x-api-key: ADYEN_API_KEY' \
-H 'content-type: application/json' \
-d '{
"reference": "YOUR_PAYMENT_REFERENCE",
"amount": {
"value": 4200,
"currency": "EUR"
},
"shopperReference": "YOUR_SHOPPER_REFERENCE",
"description": "Blue Bag - ModelM671",
"countryCode": "NL",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"shopperLocale": "nl-NL"
}'
// Adyen Java API Library v25.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.*;
Client client = new Client("ADYEN_API_KEY", Environment.TEST);
// Request objects
Amount amount = new Amount()
.currency("EUR")
.value(4200L);
PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest()
.reference("YOUR_PAYMENT_REFERENCE")
.amount(amount)
.merchantAccount("YOUR_MERCHANT_ACCOUNT")
.countryCode("NL")
.description("Blue Bag - ModelM671")
.shopperLocale("nl-NL")
.shopperReference("YOUR_SHOPPER_REFERENCE");
// Make the request
PaymentLinksApi service = new PaymentLinksApi(client);
PaymentLinkResponse response = service.paymentLinks(paymentLinkRequest, new RequestOptions().idempotencyKey("UUID"));
// Adyen PHP API Library v17.4.0
use Adyen\Client;
use Adyen\Environment;
use Adyen\Model\Checkout\Amount;
use Adyen\Model\Checkout\PaymentLinkRequest;
use Adyen\Service\Checkout\PaymentLinksApi;
$client = new Client();
$client->setXApiKey("ADYEN_API_KEY");
$client->setEnvironment(Environment::TEST);
// Request objects
$amount = new Amount();
$amount
->setCurrency("EUR")
->setValue(4200);
$paymentLinkRequest = new PaymentLinkRequest();
$paymentLinkRequest
->setReference("YOUR_PAYMENT_REFERENCE")
->setAmount($amount)
->setMerchantAccount("YOUR_MERCHANT_ACCOUNT")
->setCountryCode("NL")
->setDescription("Blue Bag - ModelM671")
->setShopperLocale("nl-NL")
->setShopperReference("YOUR_SHOPPER_REFERENCE");
$requestOptions['idempotencyKey'] = 'UUID';
// Make the request
$service = new PaymentLinksApi($client);
$response = $service->paymentLinks($paymentLinkRequest, $requestOptions);
// Adyen .net API Library v14.3.0
using Adyen;
using Environment = Adyen.Model.Environment;
using Adyen.Model;
using Adyen.Model.Checkout;
using Adyen.Service.Checkout;
var config = new Config()
{
XApiKey = "ADYEN_API_KEY",
Environment = Environment.Test
};
var client = new Client(config);
// Fill in your request objects
Amount amount = new Amount
{
Currency = "EUR",
Value = 4200
};
PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest
{
Reference = "YOUR_PAYMENT_REFERENCE",
Amount = amount,
MerchantAccount = "YOUR_MERCHANT_ACCOUNT",
CountryCode = "NL",
Description = "Blue Bag - ModelM671",
ShopperLocale = "nl-NL",
ShopperReference = "YOUR_SHOPPER_REFERENCE"
};
// Make the request
var service = new PaymentLinksService(client);
var response = service.PaymentLinks(paymentLinkRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"});
// Adyen Node API Library v16.2.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: "ADYEN_API_KEY", environment: "TEST"});
// Create the request object
const paymentLinkRequest = {
reference: "YOUR_PAYMENT_REFERENCE",
amount: {
value: 4200,
currency: "EUR"
},
shopperReference: "YOUR_SHOPPER_REFERENCE",
description: "Blue Bag - ModelM671",
countryCode: "NL",
merchantAccount: "YOUR_MERCHANT_ACCOUNT",
shopperLocale: "nl-NL"
}
// Make the request
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentLinksApi.paymentLinks(paymentLinkRequest, { idempotencyKey: "UUID" });
// Adyen Go API Library v9.2.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"
)
client := adyen.NewClient(&common.Config{
ApiKey: "ADYEN_API_KEY",
Environment: common.TestEnv,
})
// Fill in your request objects
amount := checkout.Amount{
Currency: "EUR",
Value: 4200,
}
paymentLinkRequest := checkout.PaymentLinkRequest{
Reference: "YOUR_PAYMENT_REFERENCE",
Amount: amount,
MerchantAccount: "YOUR_MERCHANT_ACCOUNT",
CountryCode: common.PtrString("NL"),
Description: common.PtrString("Blue Bag - ModelM671"),
ShopperLocale: common.PtrString("nl-NL"),
ShopperReference: common.PtrString("YOUR_SHOPPER_REFERENCE"),
}
// Make the request
service := client.Checkout()
req := service.PaymentLinksApi.PaymentLinksInput().IdempotencyKey("UUID").PaymentLinkRequest(paymentLinkRequest)
res, httpRes, err := service.PaymentLinksApi.PaymentLinks(context.Background(), req)
# Adyen Python API Library v12.2.0
import Adyen
adyen = Adyen.Adyen()
adyen.client.xapikey = "ADYEN_API_KEY"
adyen.client.platform = "test" # The environment to use library in.
json_request = {
"reference": "YOUR_PAYMENT_REFERENCE",
"amount": {
"value": 4200,
"currency": "EUR"
},
"shopperReference": "YOUR_SHOPPER_REFERENCE",
"description": "Blue Bag - ModelM671",
"countryCode": "NL",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"shopperLocale": "nl-NL"
}
result = adyen.checkout.payment_links_api.payment_links(request=json_request, idempotency_key="UUID")
# Adyen Ruby API Library v9.2.0
require "adyen-ruby-api-library"
adyen = Adyen::Client.new
adyen.api_key = 'ADYEN_API_KEY'
adyen.env = :test # Set to "live" for live environment
request_body = {
:reference => 'YOUR_PAYMENT_REFERENCE',
:amount => {
:value => 4200,
:currency => 'EUR'
},
:shopperReference => 'YOUR_SHOPPER_REFERENCE',
:description => 'Blue Bag - ModelM671',
:countryCode => 'NL',
:merchantAccount => 'YOUR_MERCHANT_ACCOUNT',
:shopperLocale => 'nl-NL'
}
result = adyen.checkout.payment_links_api.payment_links(request_body, headers: { 'Idempotency-Key' => 'UUID' })
// Adyen Node API Library v16.2.0
// Require the parts of the module you want to use
import { Client, CheckoutAPI, Types } from "@adyen/api-library";
// Initialize the client object
const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});
// Create the request objects
const amount: Types.checkout.Amount = {
currency: "EUR",
value: 4200
};
const paymentLinkRequest: Types.checkout.PaymentLinkRequest = {
reference: "YOUR_PAYMENT_REFERENCE",
amount: amount,
merchantAccount: "YOUR_MERCHANT_ACCOUNT",
countryCode: "NL",
description: "Blue Bag - ModelM671",
shopperLocale: "nl-NL",
shopperReference: "YOUR_SHOPPER_REFERENCE"
};
// Make the request
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentLinksApi.paymentLinks(paymentLinkRequest, { idempotencyKey: "UUID" });
- 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.
{
"amount": {
"currency": "EUR",
"value": 4200
},
"countryCode": "NL",
"description": "Blue Bag - ModelM671",
"expiresAt": "2020-07-25T11:32:20Z",
"id": "PL50C5F751CED39G71",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"reference": "YOUR_PAYMENT_REFERENCE",
"shopperLocale": "nl-NL",
"shopperReference": "YOUR_SHOPPER_REFERENCE",
"url": "https://test.adyen.link/PL50C5F751CED39G71"
}
Step 2: Send the payment link to your shopper
Use theurl 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:
https://ca-live.adyen.com/ca/ca/transactions/payment-link-details.shtml?d=PAYMENT_LINK_ID
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.successDescription Action to take true The shopper successfully completed the payment. Inform the shopper that the payment has been successful, and proceed with the order. If you have enabled manual capture, you also need to capture the payment. false The shopper attempted to pay but the transaction failed. The payment page informs the shopper that the payment was unsuccessful, and prompts them to try again. If the shopper still doesn’t make a successful payment, you may want to reach out to them to follow up.
{
"notificationItems":[
{
"NotificationRequestItem":{
"additionalData":{
...
"paymentLinkId":"PL50C5F751CED39G71"
},
"amount":{
"currency":"EUR",
"value":4200
},
...
"eventCode":"AUTHORISATION",
"merchantAccountCode":"YOUR_MERCHANT_ACCOUNT",
"merchantReference":"YOUR_ORDER_NUMBER",
"pspReference":"852593065346377D",
"success":"true"
}
}
]
}
Get details about a payment link
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 detailscurl https://checkout-test.adyen.com/v68/paymentLinks/PL50C5F751CED39G71 \
-X GET \
-H'x-api-key: ADYEN_API_KEY'
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
{
"amount": {
"currency": "EUR",
"value": 4200
},
"countryCode": "NL",
"expiresAt": "2020-06-23T12:25:28Z",
"id": "PL50C5F751CED39G71",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"reference": "YOUR_PAYMENT_REFERENCE",
"shopperLocale": "nl-NL",
"status": "active",
"url": "https://test.adyen.link/PL50C5F751CED39G71"
}
Create a reusable payment link
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 linkcurl https://checkout-test.adyen.com/v68/paymentLinks \
-H'x-api-key: ADYEN_API_KEY' \
-H 'content-type: application/json' \
-d '{
"reference": "YOUR_PAYMENT_REFERENCE",
"amount": {
"value": 850,
"currency": "USD"
},
"description": "Donation",
"countryCode": "US",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"shopperLocale": "en-US",
"reusable" : true
}'
// Adyen Java API Library v25.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.*;
Client client = new Client("ADYEN_API_KEY", Environment.TEST);
// Request objects
Amount amount = new Amount()
.currency("USD")
.value(850L);
PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest()
.reference("YOUR_PAYMENT_REFERENCE")
.amount(amount)
.merchantAccount("YOUR_MERCHANT_ACCOUNT")
.countryCode("US")
.description("Donation")
.shopperLocale("en-US")
.reusable(true);
// Make the request
PaymentLinksApi service = new PaymentLinksApi(client);
PaymentLinkResponse response = service.paymentLinks(paymentLinkRequest, new RequestOptions().idempotencyKey("UUID"));
// Adyen PHP API Library v17.4.0
use Adyen\Client;
use Adyen\Environment;
use Adyen\Model\Checkout\Amount;
use Adyen\Model\Checkout\PaymentLinkRequest;
use Adyen\Service\Checkout\PaymentLinksApi;
$client = new Client();
$client->setXApiKey("ADYEN_API_KEY");
$client->setEnvironment(Environment::TEST);
// Request objects
$amount = new Amount();
$amount
->setCurrency("USD")
->setValue(850);
$paymentLinkRequest = new PaymentLinkRequest();
$paymentLinkRequest
->setReference("YOUR_PAYMENT_REFERENCE")
->setAmount($amount)
->setMerchantAccount("YOUR_MERCHANT_ACCOUNT")
->setCountryCode("US")
->setDescription("Donation")
->setShopperLocale("en-US")
->setReusable(true);
$requestOptions['idempotencyKey'] = 'UUID';
// Make the request
$service = new PaymentLinksApi($client);
$response = $service->paymentLinks($paymentLinkRequest, $requestOptions);
// Adyen .net API Library v14.3.0
using Adyen;
using Environment = Adyen.Model.Environment;
using Adyen.Model;
using Adyen.Model.Checkout;
using Adyen.Service.Checkout;
var config = new Config()
{
XApiKey = "ADYEN_API_KEY",
Environment = Environment.Test
};
var client = new Client(config);
// Fill in your request objects
Amount amount = new Amount
{
Currency = "USD",
Value = 850
};
PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest
{
Reference = "YOUR_PAYMENT_REFERENCE",
Amount = amount,
MerchantAccount = "YOUR_MERCHANT_ACCOUNT",
CountryCode = "US",
Description = "Donation",
ShopperLocale = "en-US",
Reusable = true
};
// Make the request
var service = new PaymentLinksService(client);
var response = service.PaymentLinks(paymentLinkRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"});
// Adyen Node API Library v16.2.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: "ADYEN_API_KEY", environment: "TEST"});
// Create the request object
const paymentLinkRequest = {
reference: "YOUR_PAYMENT_REFERENCE",
amount: {
value: 850,
currency: "USD"
},
description: "Donation",
countryCode: "US",
merchantAccount: "YOUR_MERCHANT_ACCOUNT",
shopperLocale: "en-US",
reusable: true
}
// Make the request
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentLinksApi.paymentLinks(paymentLinkRequest, { idempotencyKey: "UUID" });
// Adyen Go API Library v9.2.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"
)
client := adyen.NewClient(&common.Config{
ApiKey: "ADYEN_API_KEY",
Environment: common.TestEnv,
})
// Fill in your request objects
amount := checkout.Amount{
Currency: "USD",
Value: 850,
}
paymentLinkRequest := checkout.PaymentLinkRequest{
Reference: "YOUR_PAYMENT_REFERENCE",
Amount: amount,
MerchantAccount: "YOUR_MERCHANT_ACCOUNT",
CountryCode: common.PtrString("US"),
Description: common.PtrString("Donation"),
ShopperLocale: common.PtrString("en-US"),
Reusable: common.PtrBool(true),
}
// Make the request
service := client.Checkout()
req := service.PaymentLinksApi.PaymentLinksInput().IdempotencyKey("UUID").PaymentLinkRequest(paymentLinkRequest)
res, httpRes, err := service.PaymentLinksApi.PaymentLinks(context.Background(), req)
# Adyen Python API Library v12.2.0
import Adyen
adyen = Adyen.Adyen()
adyen.client.xapikey = "ADYEN_API_KEY"
adyen.client.platform = "test" # The environment to use library in.
json_request = {
"reference": "YOUR_PAYMENT_REFERENCE",
"amount": {
"value": 850,
"currency": "USD"
},
"description": "Donation",
"countryCode": "US",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"shopperLocale": "en-US",
"reusable": True
}
result = adyen.checkout.payment_links_api.payment_links(request=json_request, idempotency_key="UUID")
# Adyen Ruby API Library v9.2.0
require "adyen-ruby-api-library"
adyen = Adyen::Client.new
adyen.api_key = 'ADYEN_API_KEY'
adyen.env = :test # Set to "live" for live environment
request_body = {
:reference => 'YOUR_PAYMENT_REFERENCE',
:amount => {
:value => 850,
:currency => 'USD'
},
:description => 'Donation',
:countryCode => 'US',
:merchantAccount => 'YOUR_MERCHANT_ACCOUNT',
:shopperLocale => 'en-US',
:reusable => true
}
result = adyen.checkout.payment_links_api.payment_links(request_body, headers: { 'Idempotency-Key' => 'UUID' })
// Adyen Node API Library v16.2.0
// Require the parts of the module you want to use
import { Client, CheckoutAPI, Types } from "@adyen/api-library";
// Initialize the client object
const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});
// Create the request objects
const amount: Types.checkout.Amount = {
currency: "USD",
value: 850
};
const paymentLinkRequest: Types.checkout.PaymentLinkRequest = {
reference: "YOUR_PAYMENT_REFERENCE",
amount: amount,
merchantAccount: "YOUR_MERCHANT_ACCOUNT",
countryCode: "US",
description: "Donation",
shopperLocale: "en-US",
reusable: true
};
// Make the request
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentLinksApi.paymentLinks(paymentLinkRequest, { idempotencyKey: "UUID" });
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:
| Business model | recurringProcessingModel | Description |
|---|---|---|
| One-off payments | CardOnFile | Tokenize the customer’s card details, and with future payment links present the customer’s stored card on the payment page. |
| Subscription payments | Subscription | Tokenize the customer’s card for recurring payments that occur at regular intervals without the customer being present. |
| Unscheduled recurring payments | UnscheduledCardOnFile | Tokenize the customer’s card for recurring payments that occur on a non-fixed schedule without the customer being present. This includes automatic top-ups when the cardholder’s balance drops below a certain amount. |
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.-
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.
shopperReferenceShopperID-A16728. Create a payment link to save card detailscurl
curl https://checkout-test.adyen.com/v68/paymentLinks \ -H'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "reference": "YOUR_PAYMENT_REFERENCE", "amount": { "value": 4250, "currency": "EUR" }, "description": "Black sneakers - X51", "countryCode": "NL", "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "shopperLocale": "nl-NL", "shopperReference": "ShopperID-A16728", "storePaymentMethodMode": "askForConsent", "recurringProcessingModel": "CardOnFile" }'Java
// Adyen Java API Library v25.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.*; Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Request objects Amount amount = new Amount() .currency("EUR") .value(4250L); PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest() .reference("YOUR_PAYMENT_REFERENCE") .storePaymentMethodMode(PaymentLinkRequest.StorePaymentMethodModeEnum.ASKFORCONSENT) .amount(amount) .merchantAccount("YOUR_MERCHANT_ACCOUNT") .countryCode("NL") .recurringProcessingModel(PaymentLinkRequest.RecurringProcessingModelEnum.CARDONFILE) .description("Black sneakers - X51") .shopperLocale("nl-NL") .shopperReference("ShopperID-A16728"); // Make the request PaymentLinksApi service = new PaymentLinksApi(client); PaymentLinkResponse response = service.paymentLinks(paymentLinkRequest, new RequestOptions().idempotencyKey("UUID"));PHP
// Adyen PHP API Library v17.4.0 use Adyen\Client; use Adyen\Environment; use Adyen\Model\Checkout\Amount; use Adyen\Model\Checkout\PaymentLinkRequest; use Adyen\Service\Checkout\PaymentLinksApi; $client = new Client(); $client->setXApiKey("ADYEN_API_KEY"); $client->setEnvironment(Environment::TEST); // Request objects $amount = new Amount(); $amount ->setCurrency("EUR") ->setValue(4250); $paymentLinkRequest = new PaymentLinkRequest(); $paymentLinkRequest ->setReference("YOUR_PAYMENT_REFERENCE") ->setStorePaymentMethodMode("askForConsent") ->setAmount($amount) ->setMerchantAccount("YOUR_MERCHANT_ACCOUNT") ->setCountryCode("NL") ->setRecurringProcessingModel("CardOnFile") ->setDescription("Black sneakers - X51") ->setShopperLocale("nl-NL") ->setShopperReference("ShopperID-A16728"); $requestOptions['idempotencyKey'] = 'UUID'; // Make the request $service = new PaymentLinksApi($client); $response = $service->paymentLinks($paymentLinkRequest, $requestOptions);C#
// Adyen .net API Library v14.3.0 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.Checkout; using Adyen.Service.Checkout; var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Fill in your request objects Amount amount = new Amount { Currency = "EUR", Value = 4250 }; PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest { Reference = "YOUR_PAYMENT_REFERENCE", StorePaymentMethodMode = PaymentLinkRequest.StorePaymentMethodModeEnum.AskForConsent, Amount = amount, MerchantAccount = "YOUR_MERCHANT_ACCOUNT", CountryCode = "NL", RecurringProcessingModel = PaymentLinkRequest.RecurringProcessingModelEnum.CardOnFile, Description = "Black sneakers - X51", ShopperLocale = "nl-NL", ShopperReference = "ShopperID-A16728" }; // Make the request var service = new PaymentLinksService(client); var response = service.PaymentLinks(paymentLinkRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"});NodeJS (JavaScript)
// Adyen Node API Library v16.2.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: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object const paymentLinkRequest = { reference: "YOUR_PAYMENT_REFERENCE", amount: { value: 4250, currency: "EUR" }, description: "Black sneakers - X51", countryCode: "NL", merchantAccount: "YOUR_MERCHANT_ACCOUNT", shopperLocale: "nl-NL", shopperReference: "ShopperID-A16728", storePaymentMethodMode: "askForConsent", recurringProcessingModel: "CardOnFile" } // Make the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentLinksApi.paymentLinks(paymentLinkRequest, { idempotencyKey: "UUID" });Go
// Adyen Go API Library v9.2.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" ) client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Fill in your request objects amount := checkout.Amount{ Currency: "EUR", Value: 4250, } paymentLinkRequest := checkout.PaymentLinkRequest{ Reference: "YOUR_PAYMENT_REFERENCE", StorePaymentMethodMode: common.PtrString("askForConsent"), Amount: amount, MerchantAccount: "YOUR_MERCHANT_ACCOUNT", CountryCode: common.PtrString("NL"), RecurringProcessingModel: common.PtrString("CardOnFile"), Description: common.PtrString("Black sneakers - X51"), ShopperLocale: common.PtrString("nl-NL"), ShopperReference: common.PtrString("ShopperID-A16728"), } // Make the request service := client.Checkout() req := service.PaymentLinksApi.PaymentLinksInput().IdempotencyKey("UUID").PaymentLinkRequest(paymentLinkRequest) res, httpRes, err := service.PaymentLinksApi.PaymentLinks(context.Background(), req)Python
# Adyen Python API Library v12.2.0 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" adyen.client.platform = "test" # The environment to use library in. json_request = { "reference": "YOUR_PAYMENT_REFERENCE", "amount": { "value": 4250, "currency": "EUR" }, "description": "Black sneakers - X51", "countryCode": "NL", "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "shopperLocale": "nl-NL", "shopperReference": "ShopperID-A16728", "storePaymentMethodMode": "askForConsent", "recurringProcessingModel": "CardOnFile" } result = adyen.checkout.payment_links_api.payment_links(request=json_request, idempotency_key="UUID")Ruby
# Adyen Ruby API Library v9.2.0 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' adyen.env = :test # Set to "live" for live environment request_body = { :reference => 'YOUR_PAYMENT_REFERENCE', :amount => { :value => 4250, :currency => 'EUR' }, :description => 'Black sneakers - X51', :countryCode => 'NL', :merchantAccount => 'YOUR_MERCHANT_ACCOUNT', :shopperLocale => 'nl-NL', :shopperReference => 'ShopperID-A16728', :storePaymentMethodMode => 'askForConsent', :recurringProcessingModel => 'CardOnFile' } result = adyen.checkout.payment_links_api.payment_links(request_body, headers: { 'Idempotency-Key' => 'UUID' })NodeJS (TypeScript)
The shopper’s card details will be tokenized after they make a successful payment.// Adyen Node API Library v16.2.0 // Require the parts of the module you want to use import { Client, CheckoutAPI, Types } from "@adyen/api-library"; // Initialize the client object const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request objects const amount: Types.checkout.Amount = { currency: "EUR", value: 4250 }; const paymentLinkRequest: Types.checkout.PaymentLinkRequest = { reference: "YOUR_PAYMENT_REFERENCE", storePaymentMethodMode: Types.checkout.PaymentLinkRequest.StorePaymentMethodModeEnum.AskForConsent, amount: amount, merchantAccount: "YOUR_MERCHANT_ACCOUNT", countryCode: "NL", recurringProcessingModel: Types.checkout.PaymentLinkRequest.RecurringProcessingModelEnum.CardOnFile, description: "Black sneakers - X51", shopperLocale: "nl-NL", shopperReference: "ShopperID-A16728" }; // Make the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentLinksApi.paymentLinks(paymentLinkRequest, { idempotencyKey: "UUID" });
-
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
shopperReferenceShopperID-A16728. Create a payment link that shows stored card detailscurl
curl https://checkout-test.adyen.com/v68/paymentLinks \ -H'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "reference": "YOUR_PAYMENT_REFERENCE", "amount": { "value": 4250, "currency": "EUR" }, "description": "Blue backpack - BK11", "countryCode": "NL", "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "shopperLocale": "nl-NL", "shopperReference": "ShopperID-A16728", "recurringProcessingModel": "CardOnFile" }'Java
// Adyen Java API Library v25.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.*; Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Request objects Amount amount = new Amount() .currency("EUR") .value(4250L); PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest() .reference("YOUR_PAYMENT_REFERENCE") .amount(amount) .merchantAccount("YOUR_MERCHANT_ACCOUNT") .countryCode("NL") .recurringProcessingModel(PaymentLinkRequest.RecurringProcessingModelEnum.CARDONFILE) .description("Blue backpack - BK11") .shopperLocale("nl-NL") .shopperReference("ShopperID-A16728"); // Make the request PaymentLinksApi service = new PaymentLinksApi(client); PaymentLinkResponse response = service.paymentLinks(paymentLinkRequest, new RequestOptions().idempotencyKey("UUID"));PHP
// Adyen PHP API Library v17.4.0 use Adyen\Client; use Adyen\Environment; use Adyen\Model\Checkout\Amount; use Adyen\Model\Checkout\PaymentLinkRequest; use Adyen\Service\Checkout\PaymentLinksApi; $client = new Client(); $client->setXApiKey("ADYEN_API_KEY"); $client->setEnvironment(Environment::TEST); // Request objects $amount = new Amount(); $amount ->setCurrency("EUR") ->setValue(4250); $paymentLinkRequest = new PaymentLinkRequest(); $paymentLinkRequest ->setReference("YOUR_PAYMENT_REFERENCE") ->setAmount($amount) ->setMerchantAccount("YOUR_MERCHANT_ACCOUNT") ->setCountryCode("NL") ->setRecurringProcessingModel("CardOnFile") ->setDescription("Blue backpack - BK11") ->setShopperLocale("nl-NL") ->setShopperReference("ShopperID-A16728"); $requestOptions['idempotencyKey'] = 'UUID'; // Make the request $service = new PaymentLinksApi($client); $response = $service->paymentLinks($paymentLinkRequest, $requestOptions);C#
// Adyen .net API Library v14.3.0 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.Checkout; using Adyen.Service.Checkout; var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Fill in your request objects Amount amount = new Amount { Currency = "EUR", Value = 4250 }; PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest { Reference = "YOUR_PAYMENT_REFERENCE", Amount = amount, MerchantAccount = "YOUR_MERCHANT_ACCOUNT", CountryCode = "NL", RecurringProcessingModel = PaymentLinkRequest.RecurringProcessingModelEnum.CardOnFile, Description = "Blue backpack - BK11", ShopperLocale = "nl-NL", ShopperReference = "ShopperID-A16728" }; // Make the request var service = new PaymentLinksService(client); var response = service.PaymentLinks(paymentLinkRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"});NodeJS (JavaScript)
// Adyen Node API Library v16.2.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: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object const paymentLinkRequest = { reference: "YOUR_PAYMENT_REFERENCE", amount: { value: 4250, currency: "EUR" }, description: "Blue backpack - BK11", countryCode: "NL", merchantAccount: "YOUR_MERCHANT_ACCOUNT", shopperLocale: "nl-NL", shopperReference: "ShopperID-A16728", recurringProcessingModel: "CardOnFile" } // Make the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentLinksApi.paymentLinks(paymentLinkRequest, { idempotencyKey: "UUID" });Go
// Adyen Go API Library v9.2.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" ) client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Fill in your request objects amount := checkout.Amount{ Currency: "EUR", Value: 4250, } paymentLinkRequest := checkout.PaymentLinkRequest{ Reference: "YOUR_PAYMENT_REFERENCE", Amount: amount, MerchantAccount: "YOUR_MERCHANT_ACCOUNT", CountryCode: common.PtrString("NL"), RecurringProcessingModel: common.PtrString("CardOnFile"), Description: common.PtrString("Blue backpack - BK11"), ShopperLocale: common.PtrString("nl-NL"), ShopperReference: common.PtrString("ShopperID-A16728"), } // Make the request service := client.Checkout() req := service.PaymentLinksApi.PaymentLinksInput().IdempotencyKey("UUID").PaymentLinkRequest(paymentLinkRequest) res, httpRes, err := service.PaymentLinksApi.PaymentLinks(context.Background(), req)Python
# Adyen Python API Library v12.2.0 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" adyen.client.platform = "test" # The environment to use library in. json_request = { "reference": "YOUR_PAYMENT_REFERENCE", "amount": { "value": 4250, "currency": "EUR" }, "description": "Blue backpack - BK11", "countryCode": "NL", "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "shopperLocale": "nl-NL", "shopperReference": "ShopperID-A16728", "recurringProcessingModel": "CardOnFile" } result = adyen.checkout.payment_links_api.payment_links(request=json_request, idempotency_key="UUID")Ruby
# Adyen Ruby API Library v9.2.0 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' adyen.env = :test # Set to "live" for live environment request_body = { :reference => 'YOUR_PAYMENT_REFERENCE', :amount => { :value => 4250, :currency => 'EUR' }, :description => 'Blue backpack - BK11', :countryCode => 'NL', :merchantAccount => 'YOUR_MERCHANT_ACCOUNT', :shopperLocale => 'nl-NL', :shopperReference => 'ShopperID-A16728', :recurringProcessingModel => 'CardOnFile' } result = adyen.checkout.payment_links_api.payment_links(request_body, headers: { 'Idempotency-Key' => 'UUID' })NodeJS (TypeScript)
// Adyen Node API Library v16.2.0 // Require the parts of the module you want to use import { Client, CheckoutAPI, Types } from "@adyen/api-library"; // Initialize the client object const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request objects const amount: Types.checkout.Amount = { currency: "EUR", value: 4250 }; const paymentLinkRequest: Types.checkout.PaymentLinkRequest = { reference: "YOUR_PAYMENT_REFERENCE", amount: amount, merchantAccount: "YOUR_MERCHANT_ACCOUNT", countryCode: "NL", recurringProcessingModel: Types.checkout.PaymentLinkRequest.RecurringProcessingModelEnum.CardOnFile, description: "Blue backpack - BK11", shopperLocale: "nl-NL", shopperReference: "ShopperID-A16728" }; // Make the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentLinksApi.paymentLinks(paymentLinkRequest, { idempotencyKey: "UUID" });
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.-
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.
shopperReferenceShopper-B7183. Create a payment link to tokenize for subscriptioncurl
curl https://checkout-test.adyen.com/v68/paymentLinks \ -H'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "reference": "YOUR_PAYMENT_REFERENCE", "amount": { "value": 0, "currency": "EUR" }, "description": "Coffee Subscription", "countryCode": "NL", "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "shopperLocale": "nl-NL", "shopperReference": "Shopper-B7183", "storePaymentMethodMode": "askForConsent", "recurringProcessingModel": "Subscription" }'Java
// Adyen Java API Library v25.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.*; Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Request objects Amount amount = new Amount() .currency("EUR") .value(0L); PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest() .reference("YOUR_PAYMENT_REFERENCE") .storePaymentMethodMode(PaymentLinkRequest.StorePaymentMethodModeEnum.ASKFORCONSENT) .amount(amount) .merchantAccount("YOUR_MERCHANT_ACCOUNT") .countryCode("NL") .recurringProcessingModel(PaymentLinkRequest.RecurringProcessingModelEnum.SUBSCRIPTION) .description("Coffee Subscription") .shopperLocale("nl-NL") .shopperReference("Shopper-B7183"); // Make the request PaymentLinksApi service = new PaymentLinksApi(client); PaymentLinkResponse response = service.paymentLinks(paymentLinkRequest, new RequestOptions().idempotencyKey("UUID"));PHP
// Adyen PHP API Library v17.4.0 use Adyen\Client; use Adyen\Environment; use Adyen\Model\Checkout\Amount; use Adyen\Model\Checkout\PaymentLinkRequest; use Adyen\Service\Checkout\PaymentLinksApi; $client = new Client(); $client->setXApiKey("ADYEN_API_KEY"); $client->setEnvironment(Environment::TEST); // Request objects $amount = new Amount(); $amount ->setCurrency("EUR") ->setValue(0); $paymentLinkRequest = new PaymentLinkRequest(); $paymentLinkRequest ->setReference("YOUR_PAYMENT_REFERENCE") ->setStorePaymentMethodMode("askForConsent") ->setAmount($amount) ->setMerchantAccount("YOUR_MERCHANT_ACCOUNT") ->setCountryCode("NL") ->setRecurringProcessingModel("Subscription") ->setDescription("Coffee Subscription") ->setShopperLocale("nl-NL") ->setShopperReference("Shopper-B7183"); $requestOptions['idempotencyKey'] = 'UUID'; // Make the request $service = new PaymentLinksApi($client); $response = $service->paymentLinks($paymentLinkRequest, $requestOptions);C#
// Adyen .net API Library v14.3.0 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.Checkout; using Adyen.Service.Checkout; var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Fill in your request objects Amount amount = new Amount { Currency = "EUR", Value = 0 }; PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest { Reference = "YOUR_PAYMENT_REFERENCE", StorePaymentMethodMode = PaymentLinkRequest.StorePaymentMethodModeEnum.AskForConsent, Amount = amount, MerchantAccount = "YOUR_MERCHANT_ACCOUNT", CountryCode = "NL", RecurringProcessingModel = PaymentLinkRequest.RecurringProcessingModelEnum.Subscription, Description = "Coffee Subscription", ShopperLocale = "nl-NL", ShopperReference = "Shopper-B7183" }; // Make the request var service = new PaymentLinksService(client); var response = service.PaymentLinks(paymentLinkRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"});NodeJS (JavaScript)
// Adyen Node API Library v16.2.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: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object const paymentLinkRequest = { reference: "YOUR_PAYMENT_REFERENCE", amount: { value: 0, currency: "EUR" }, description: "Coffee Subscription", countryCode: "NL", merchantAccount: "YOUR_MERCHANT_ACCOUNT", shopperLocale: "nl-NL", shopperReference: "Shopper-B7183", storePaymentMethodMode: "askForConsent", recurringProcessingModel: "Subscription" } // Make the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentLinksApi.paymentLinks(paymentLinkRequest, { idempotencyKey: "UUID" });Go
// Adyen Go API Library v9.2.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" ) client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Fill in your request objects amount := checkout.Amount{ Currency: "EUR", Value: 0, } paymentLinkRequest := checkout.PaymentLinkRequest{ Reference: "YOUR_PAYMENT_REFERENCE", StorePaymentMethodMode: common.PtrString("askForConsent"), Amount: amount, MerchantAccount: "YOUR_MERCHANT_ACCOUNT", CountryCode: common.PtrString("NL"), RecurringProcessingModel: common.PtrString("Subscription"), Description: common.PtrString("Coffee Subscription"), ShopperLocale: common.PtrString("nl-NL"), ShopperReference: common.PtrString("Shopper-B7183"), } // Make the request service := client.Checkout() req := service.PaymentLinksApi.PaymentLinksInput().IdempotencyKey("UUID").PaymentLinkRequest(paymentLinkRequest) res, httpRes, err := service.PaymentLinksApi.PaymentLinks(context.Background(), req)Python
# Adyen Python API Library v12.2.0 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" adyen.client.platform = "test" # The environment to use library in. json_request = { "reference": "YOUR_PAYMENT_REFERENCE", "amount": { "value": 0, "currency": "EUR" }, "description": "Coffee Subscription", "countryCode": "NL", "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "shopperLocale": "nl-NL", "shopperReference": "Shopper-B7183", "storePaymentMethodMode": "askForConsent", "recurringProcessingModel": "Subscription" } result = adyen.checkout.payment_links_api.payment_links(request=json_request, idempotency_key="UUID")Ruby
# Adyen Ruby API Library v9.2.0 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' adyen.env = :test # Set to "live" for live environment request_body = { :reference => 'YOUR_PAYMENT_REFERENCE', :amount => { :value => 0, :currency => 'EUR' }, :description => 'Coffee Subscription', :countryCode => 'NL', :merchantAccount => 'YOUR_MERCHANT_ACCOUNT', :shopperLocale => 'nl-NL', :shopperReference => 'Shopper-B7183', :storePaymentMethodMode => 'askForConsent', :recurringProcessingModel => 'Subscription' } result = adyen.checkout.payment_links_api.payment_links(request_body, headers: { 'Idempotency-Key' => 'UUID' })NodeJS (TypeScript)
// Adyen Node API Library v16.2.0 // Require the parts of the module you want to use import { Client, CheckoutAPI, Types } from "@adyen/api-library"; // Initialize the client object const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request objects const amount: Types.checkout.Amount = { currency: "EUR", value: 0 }; const paymentLinkRequest: Types.checkout.PaymentLinkRequest = { reference: "YOUR_PAYMENT_REFERENCE", storePaymentMethodMode: Types.checkout.PaymentLinkRequest.StorePaymentMethodModeEnum.AskForConsent, amount: amount, merchantAccount: "YOUR_MERCHANT_ACCOUNT", countryCode: "NL", recurringProcessingModel: Types.checkout.PaymentLinkRequest.RecurringProcessingModelEnum.Subscription, description: "Coffee Subscription", shopperLocale: "nl-NL", shopperReference: "Shopper-B7183" }; // Make the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentLinksApi.paymentLinks(paymentLinkRequest, { idempotencyKey: "UUID" }); - After the shopper completes the payment or the preauthorization, make a POST /paymentMethods request to get the shopper’s tokenized payment details.
- 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.-
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.
shopperReferenceShopper-C5250. Create a payment link to tokenize for automatic top-upscurl
curl https://checkout-test.adyen.com/v68/paymentLinks \ -H'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "reference": "YOUR_PAYMENT_REFERENCE", "amount": { "value": 0, "currency": "EUR" }, "description": "Account top-up agreement", "countryCode": "NL", "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "shopperLocale": "nl-NL", "shopperReference": "Shopper-C5250", "storePaymentMethodMode": "askForConsent", "recurringProcessingModel": "UnscheduledCardOnFile" }'Java
// Adyen Java API Library v25.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.*; Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Request objects Amount amount = new Amount() .currency("EUR") .value(0L); PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest() .reference("YOUR_PAYMENT_REFERENCE") .storePaymentMethodMode(PaymentLinkRequest.StorePaymentMethodModeEnum.ASKFORCONSENT) .amount(amount) .merchantAccount("YOUR_MERCHANT_ACCOUNT") .countryCode("NL") .recurringProcessingModel(PaymentLinkRequest.RecurringProcessingModelEnum.UNSCHEDULEDCARDONFILE) .description("Account top-up agreement") .shopperLocale("nl-NL") .shopperReference("Shopper-C5250"); // Make the request PaymentLinksApi service = new PaymentLinksApi(client); PaymentLinkResponse response = service.paymentLinks(paymentLinkRequest, new RequestOptions().idempotencyKey("UUID"));PHP
// Adyen PHP API Library v17.4.0 use Adyen\Client; use Adyen\Environment; use Adyen\Model\Checkout\Amount; use Adyen\Model\Checkout\PaymentLinkRequest; use Adyen\Service\Checkout\PaymentLinksApi; $client = new Client(); $client->setXApiKey("ADYEN_API_KEY"); $client->setEnvironment(Environment::TEST); // Request objects $amount = new Amount(); $amount ->setCurrency("EUR") ->setValue(0); $paymentLinkRequest = new PaymentLinkRequest(); $paymentLinkRequest ->setReference("YOUR_PAYMENT_REFERENCE") ->setStorePaymentMethodMode("askForConsent") ->setAmount($amount) ->setMerchantAccount("YOUR_MERCHANT_ACCOUNT") ->setCountryCode("NL") ->setRecurringProcessingModel("UnscheduledCardOnFile") ->setDescription("Account top-up agreement") ->setShopperLocale("nl-NL") ->setShopperReference("Shopper-C5250"); $requestOptions['idempotencyKey'] = 'UUID'; // Make the request $service = new PaymentLinksApi($client); $response = $service->paymentLinks($paymentLinkRequest, $requestOptions);C#
// Adyen .net API Library v14.3.0 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.Checkout; using Adyen.Service.Checkout; var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Fill in your request objects Amount amount = new Amount { Currency = "EUR", Value = 0 }; PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest { Reference = "YOUR_PAYMENT_REFERENCE", StorePaymentMethodMode = PaymentLinkRequest.StorePaymentMethodModeEnum.AskForConsent, Amount = amount, MerchantAccount = "YOUR_MERCHANT_ACCOUNT", CountryCode = "NL", RecurringProcessingModel = PaymentLinkRequest.RecurringProcessingModelEnum.UnscheduledCardOnFile, Description = "Account top-up agreement", ShopperLocale = "nl-NL", ShopperReference = "Shopper-C5250" }; // Make the request var service = new PaymentLinksService(client); var response = service.PaymentLinks(paymentLinkRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"});NodeJS (JavaScript)
// Adyen Node API Library v16.2.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: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object const paymentLinkRequest = { reference: "YOUR_PAYMENT_REFERENCE", amount: { value: 0, currency: "EUR" }, description: "Account top-up agreement", countryCode: "NL", merchantAccount: "YOUR_MERCHANT_ACCOUNT", shopperLocale: "nl-NL", shopperReference: "Shopper-C5250", storePaymentMethodMode: "askForConsent", recurringProcessingModel: "UnscheduledCardOnFile" } // Make the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentLinksApi.paymentLinks(paymentLinkRequest, { idempotencyKey: "UUID" });Go
// Adyen Go API Library v9.2.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" ) client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Fill in your request objects amount := checkout.Amount{ Currency: "EUR", Value: 0, } paymentLinkRequest := checkout.PaymentLinkRequest{ Reference: "YOUR_PAYMENT_REFERENCE", StorePaymentMethodMode: common.PtrString("askForConsent"), Amount: amount, MerchantAccount: "YOUR_MERCHANT_ACCOUNT", CountryCode: common.PtrString("NL"), RecurringProcessingModel: common.PtrString("UnscheduledCardOnFile"), Description: common.PtrString("Account top-up agreement"), ShopperLocale: common.PtrString("nl-NL"), ShopperReference: common.PtrString("Shopper-C5250"), } // Make the request service := client.Checkout() req := service.PaymentLinksApi.PaymentLinksInput().IdempotencyKey("UUID").PaymentLinkRequest(paymentLinkRequest) res, httpRes, err := service.PaymentLinksApi.PaymentLinks(context.Background(), req)Python
# Adyen Python API Library v12.2.0 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" adyen.client.platform = "test" # The environment to use library in. json_request = { "reference": "YOUR_PAYMENT_REFERENCE", "amount": { "value": 0, "currency": "EUR" }, "description": "Account top-up agreement", "countryCode": "NL", "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "shopperLocale": "nl-NL", "shopperReference": "Shopper-C5250", "storePaymentMethodMode": "askForConsent", "recurringProcessingModel": "UnscheduledCardOnFile" } result = adyen.checkout.payment_links_api.payment_links(request=json_request, idempotency_key="UUID")Ruby
# Adyen Ruby API Library v9.2.0 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' adyen.env = :test # Set to "live" for live environment request_body = { :reference => 'YOUR_PAYMENT_REFERENCE', :amount => { :value => 0, :currency => 'EUR' }, :description => 'Account top-up agreement', :countryCode => 'NL', :merchantAccount => 'YOUR_MERCHANT_ACCOUNT', :shopperLocale => 'nl-NL', :shopperReference => 'Shopper-C5250', :storePaymentMethodMode => 'askForConsent', :recurringProcessingModel => 'UnscheduledCardOnFile' } result = adyen.checkout.payment_links_api.payment_links(request_body, headers: { 'Idempotency-Key' => 'UUID' })NodeJS (TypeScript)
// Adyen Node API Library v16.2.0 // Require the parts of the module you want to use import { Client, CheckoutAPI, Types } from "@adyen/api-library"; // Initialize the client object const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request objects const amount: Types.checkout.Amount = { currency: "EUR", value: 0 }; const paymentLinkRequest: Types.checkout.PaymentLinkRequest = { reference: "YOUR_PAYMENT_REFERENCE", storePaymentMethodMode: Types.checkout.PaymentLinkRequest.StorePaymentMethodModeEnum.AskForConsent, amount: amount, merchantAccount: "YOUR_MERCHANT_ACCOUNT", countryCode: "NL", recurringProcessingModel: Types.checkout.PaymentLinkRequest.RecurringProcessingModelEnum.UnscheduledCardOnFile, description: "Account top-up agreement", shopperLocale: "nl-NL", shopperReference: "Shopper-C5250" }; // Make the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentLinksApi.paymentLinks(paymentLinkRequest, { idempotencyKey: "UUID" }); - After the shopper completes the payment or the preauthorization, make a POST /paymentMethods request to get the shopper’s tokenized payment details.
- 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.
| Payment method | Required objects |
|---|---|
| 3x 4x Oney (FR, ES) | lineItemsNote: Other shopper information such as shopper name and email are collected on the payment page. |
| Afterpay (AU, NZ) | lineItems, shopperEmail, shopperName, deliveryAddress, billingAddress |
| Klarna (AT, DK, FI, DE, NO, SE, CH, NL, GB, US) | lineItems , shopperEmail |
| PayBright (CA) | lineItems, shopperEmail, shopperName, deliveryAddress, billingAddress |
| Zip (AU) | lineItems, shopperEmail, shopperName, deliveryAddress, billingAddress |
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 lineItemscurl https://checkout-test.adyen.com/v68/paymentLinks \
-H'x-api-key: ADYEN_API_KEY' \
-H 'content-type: application/json' \
-d '{
"reference": "YOUR_ORDER_NUMBER",
"amount": {
"value": 1000,
"currency": "EUR"
},
"description": "Shoes and socks",
"countryCode": "FR",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"shopperReference": "YOUR_SHOPPER_REFERENCE",
"shopperLocale": "en-US",
"lineItems":[
{
"quantity":"1",
"amountExcludingTax":"331",
"taxPercentage":"2100",
"description":"Shoes",
"id":"Item #1",
"taxAmount":"69",
"amountIncludingTax":"400"
},
{
"quantity":"2",
"amountExcludingTax":"248",
"taxPercentage":"2100",
"description":"Socks",
"id":"Item #2",
"taxAmount":"52",
"amountIncludingTax":"300"
}
]
}'
// Adyen Java API Library v25.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.*;
Client client = new Client("ADYEN_API_KEY", Environment.TEST);
// Request objects
LineItem lineItem1 = new LineItem()
.quantity(1L)
.amountExcludingTax(331L)
.taxPercentage(2100L)
.description("Shoes")
.id("Item #1")
.taxAmount(69L)
.amountIncludingTax(400L);
LineItem lineItem2 = new LineItem()
.quantity(2L)
.amountExcludingTax(248L)
.taxPercentage(2100L)
.description("Socks")
.id("Item #2")
.taxAmount(52L)
.amountIncludingTax(300L);
Amount amount = new Amount()
.currency("EUR")
.value(1000L);
PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest()
.reference("YOUR_ORDER_NUMBER")
.lineItems(Arrays.asList(lineItem1, lineItem2))
.amount(amount)
.merchantAccount("YOUR_MERCHANT_ACCOUNT")
.countryCode("FR")
.description("Shoes and socks")
.shopperLocale("en-US")
.shopperReference("YOUR_SHOPPER_REFERENCE");
// Make the request
PaymentLinksApi service = new PaymentLinksApi(client);
PaymentLinkResponse response = service.paymentLinks(paymentLinkRequest, new RequestOptions().idempotencyKey("UUID"));
// Adyen PHP API Library v17.4.0
use Adyen\Client;
use Adyen\Environment;
use Adyen\Model\Checkout\LineItem;
use Adyen\Model\Checkout\Amount;
use Adyen\Model\Checkout\PaymentLinkRequest;
use Adyen\Service\Checkout\PaymentLinksApi;
$client = new Client();
$client->setXApiKey("ADYEN_API_KEY");
$client->setEnvironment(Environment::TEST);
// Request objects
$lineItem1 = new LineItem();
$lineItem1
->setQuantity(1)
->setAmountExcludingTax(331)
->setTaxPercentage(2100)
->setDescription("Shoes")
->setId("Item #1")
->setTaxAmount(69)
->setAmountIncludingTax(400);
$lineItem2 = new LineItem();
$lineItem2
->setQuantity(2)
->setAmountExcludingTax(248)
->setTaxPercentage(2100)
->setDescription("Socks")
->setId("Item #2")
->setTaxAmount(52)
->setAmountIncludingTax(300);
$amount = new Amount();
$amount
->setCurrency("EUR")
->setValue(1000);
$paymentLinkRequest = new PaymentLinkRequest();
$paymentLinkRequest
->setReference("YOUR_ORDER_NUMBER")
->setLineItems(array($lineItem1, $lineItem2))
->setAmount($amount)
->setMerchantAccount("YOUR_MERCHANT_ACCOUNT")
->setCountryCode("FR")
->setDescription("Shoes and socks")
->setShopperLocale("en-US")
->setShopperReference("YOUR_SHOPPER_REFERENCE");
$requestOptions['idempotencyKey'] = 'UUID';
// Make the request
$service = new PaymentLinksApi($client);
$response = $service->paymentLinks($paymentLinkRequest, $requestOptions);
// Adyen .net API Library v14.3.0
using Adyen;
using Environment = Adyen.Model.Environment;
using Adyen.Model;
using Adyen.Model.Checkout;
using Adyen.Service.Checkout;
var config = new Config()
{
XApiKey = "ADYEN_API_KEY",
Environment = Environment.Test
};
var client = new Client(config);
// Fill in your request objects
LineItem lineItem1 = new LineItem
{
Quantity = 1,
AmountExcludingTax = 331,
TaxPercentage = 2100,
Description = "Shoes",
Id = "Item #1",
TaxAmount = 69,
AmountIncludingTax = 400
};
LineItem lineItem2 = new LineItem
{
Quantity = 2,
AmountExcludingTax = 248,
TaxPercentage = 2100,
Description = "Socks",
Id = "Item #2",
TaxAmount = 52,
AmountIncludingTax = 300
};
Amount amount = new Amount
{
Currency = "EUR",
Value = 1000
};
PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest
{
Reference = "YOUR_ORDER_NUMBER",
LineItems = new List<LineItem>{ lineItem1, lineItem2 },
Amount = amount,
MerchantAccount = "YOUR_MERCHANT_ACCOUNT",
CountryCode = "FR",
Description = "Shoes and socks",
ShopperLocale = "en-US",
ShopperReference = "YOUR_SHOPPER_REFERENCE"
};
// Make the request
var service = new PaymentLinksService(client);
var response = service.PaymentLinks(paymentLinkRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"});
// Adyen Node API Library v16.2.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: "ADYEN_API_KEY", environment: "TEST"});
// Create the request object
const paymentLinkRequest = {
reference: "YOUR_ORDER_NUMBER",
amount: {
value: 1000,
currency: "EUR"
},
description: "Shoes and socks",
countryCode: "FR",
merchantAccount: "YOUR_MERCHANT_ACCOUNT",
shopperReference: "YOUR_SHOPPER_REFERENCE",
shopperLocale: "en-US",
lineItems: [ {
quantity: "1",
amountExcludingTax: "331",
taxPercentage: "2100",
description: "Shoes",
id: "Item #1",
taxAmount: "69",
amountIncludingTax: "400"
}, {
quantity: "2",
amountExcludingTax: "248",
taxPercentage: "2100",
description: "Socks",
id: "Item #2",
taxAmount: "52",
amountIncludingTax: "300"
} ]
}
// Make the request
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentLinksApi.paymentLinks(paymentLinkRequest, { idempotencyKey: "UUID" });
// Adyen Go API Library v9.2.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"
)
client := adyen.NewClient(&common.Config{
ApiKey: "ADYEN_API_KEY",
Environment: common.TestEnv,
})
// Fill in your request objects
lineItem1 := checkout.LineItem{
Quantity: common.PtrInt64(1),
AmountExcludingTax: common.PtrInt64(331),
TaxPercentage: common.PtrInt64(2100),
Description: common.PtrString("Shoes"),
Id: common.PtrString("Item #1"),
TaxAmount: common.PtrInt64(69),
AmountIncludingTax: common.PtrInt64(400),
}
lineItem2 := checkout.LineItem{
Quantity: common.PtrInt64(2),
AmountExcludingTax: common.PtrInt64(248),
TaxPercentage: common.PtrInt64(2100),
Description: common.PtrString("Socks"),
Id: common.PtrString("Item #2"),
TaxAmount: common.PtrInt64(52),
AmountIncludingTax: common.PtrInt64(300),
}
amount := checkout.Amount{
Currency: "EUR",
Value: 1000,
}
paymentLinkRequest := checkout.PaymentLinkRequest{
Reference: "YOUR_ORDER_NUMBER",
LineItems: []checkout.LineItem{
lineItem1, lineItem2,
},
Amount: amount,
MerchantAccount: "YOUR_MERCHANT_ACCOUNT",
CountryCode: common.PtrString("FR"),
Description: common.PtrString("Shoes and socks"),
ShopperLocale: common.PtrString("en-US"),
ShopperReference: common.PtrString("YOUR_SHOPPER_REFERENCE"),
}
// Make the request
service := client.Checkout()
req := service.PaymentLinksApi.PaymentLinksInput().IdempotencyKey("UUID").PaymentLinkRequest(paymentLinkRequest)
res, httpRes, err := service.PaymentLinksApi.PaymentLinks(context.Background(), req)
# Adyen Python API Library v12.2.0
import Adyen
adyen = Adyen.Adyen()
adyen.client.xapikey = "ADYEN_API_KEY"
adyen.client.platform = "test" # The environment to use library in.
json_request = {
"reference": "YOUR_ORDER_NUMBER",
"amount": {
"value": 1000,
"currency": "EUR"
},
"description": "Shoes and socks",
"countryCode": "FR",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"shopperReference": "YOUR_SHOPPER_REFERENCE",
"shopperLocale": "en-US",
"lineItems": [ {
"quantity": "1",
"amountExcludingTax": "331",
"taxPercentage": "2100",
"description": "Shoes",
"id": "Item #1",
"taxAmount": "69",
"amountIncludingTax": "400"
}, {
"quantity": "2",
"amountExcludingTax": "248",
"taxPercentage": "2100",
"description": "Socks",
"id": "Item #2",
"taxAmount": "52",
"amountIncludingTax": "300"
} ]
}
result = adyen.checkout.payment_links_api.payment_links(request=json_request, idempotency_key="UUID")
# Adyen Ruby API Library v9.2.0
require "adyen-ruby-api-library"
adyen = Adyen::Client.new
adyen.api_key = 'ADYEN_API_KEY'
adyen.env = :test # Set to "live" for live environment
request_body = {
:reference => 'YOUR_ORDER_NUMBER',
:amount => {
:value => 1000,
:currency => 'EUR'
},
:description => 'Shoes and socks',
:countryCode => 'FR',
:merchantAccount => 'YOUR_MERCHANT_ACCOUNT',
:shopperReference => 'YOUR_SHOPPER_REFERENCE',
:shopperLocale => 'en-US',
:lineItems => [ {
:quantity => '1',
:amountExcludingTax => '331',
:taxPercentage => '2100',
:description => 'Shoes',
:id => 'Item #1',
:taxAmount => '69',
:amountIncludingTax => '400'
}, {
:quantity => '2',
:amountExcludingTax => '248',
:taxPercentage => '2100',
:description => 'Socks',
:id => 'Item #2',
:taxAmount => '52',
:amountIncludingTax => '300'
} ]
}
result = adyen.checkout.payment_links_api.payment_links(request_body, headers: { 'Idempotency-Key' => 'UUID' })
// Adyen Node API Library v16.2.0
// Require the parts of the module you want to use
import { Client, CheckoutAPI, Types } from "@adyen/api-library";
// Initialize the client object
const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});
// Create the request objects
const lineItem1: Types.checkout.LineItem = {
quantity: 1,
amountExcludingTax: 331,
taxPercentage: 2100,
description: "Shoes",
id: "Item #1",
taxAmount: 69,
amountIncludingTax: 400
};
const lineItem2: Types.checkout.LineItem = {
quantity: 2,
amountExcludingTax: 248,
taxPercentage: 2100,
description: "Socks",
id: "Item #2",
taxAmount: 52,
amountIncludingTax: 300
};
const amount: Types.checkout.Amount = {
currency: "EUR",
value: 1000
};
const paymentLinkRequest: Types.checkout.PaymentLinkRequest = {
reference: "YOUR_ORDER_NUMBER",
lineItems: [lineItem1, lineItem2],
amount: amount,
merchantAccount: "YOUR_MERCHANT_ACCOUNT",
countryCode: "FR",
description: "Shoes and socks",
shopperLocale: "en-US",
shopperReference: "YOUR_SHOPPER_REFERENCE"
};
// Make the request
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentLinksApi.paymentLinks(paymentLinkRequest, { idempotencyKey: "UUID" });
Provide shopper information
For shopper information such as name, email, or address, you can either:- If using API version v67 or later, ask the shopper to fill in this information before they complete the payment, by including requiredShopperFields in your POST /paymentLinks request.
- Collect this information yourself, and include it in your POST /paymentLinks request.
- Ask shopper to provide information
- Include shopper information
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
curl https://checkout-test.adyen.com/v68/paymentLinks \
-H'x-api-key: ADYEN_API_KEY' \
-H 'content-type: application/json' \
-d '{
"reference": "YOUR_ORDER_NUMBER",
"amount": {
"value": 1000,
"currency": "SEK"
},
"description": "Shoes and socks",
"countryCode": "SE",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"shopperReference": "YOUR_SHOPPER_REFERENCE",
"requiredShopperFields": ["shopperName", "shopperEmail", "billingAddress"],
"shopperLocale": "en-US",
"lineItems":[
{
"quantity":"1",
"amountExcludingTax":"331",
"taxPercentage":"2100",
"description":"Shoes",
"id":"Item #1",
"taxAmount":"69",
"amountIncludingTax":"400"
},
{
"quantity":"2",
"amountExcludingTax":"248",
"taxPercentage":"2100",
"description":"Socks",
"id":"Item #2",
"taxAmount":"52",
"amountIncludingTax":"300"
}
]
}'
// Adyen Java API Library v25.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.*;
Client client = new Client("ADYEN_API_KEY", Environment.TEST);
// Request objects
LineItem lineItem1 = new LineItem()
.quantity(1L)
.amountExcludingTax(331L)
.taxPercentage(2100L)
.description("Shoes")
.id("Item #1")
.taxAmount(69L)
.amountIncludingTax(400L);
LineItem lineItem2 = new LineItem()
.quantity(2L)
.amountExcludingTax(248L)
.taxPercentage(2100L)
.description("Socks")
.id("Item #2")
.taxAmount(52L)
.amountIncludingTax(300L);
Amount amount = new Amount()
.currency("SEK")
.value(1000L);
PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest()
.reference("YOUR_ORDER_NUMBER")
.lineItems(Arrays.asList(lineItem1, lineItem2))
.amount(amount)
.merchantAccount("YOUR_MERCHANT_ACCOUNT")
.countryCode("SE")
.requiredShopperFields(Arrays.asList(Amount.RequiredShopperFieldsEnum.SHOPPERNAME,
Amount.RequiredShopperFieldsEnum.SHOPPEREMAIL,
Amount.RequiredShopperFieldsEnum.BILLINGADDRESS))
.description("Shoes and socks")
.shopperLocale("en-US")
.shopperReference("YOUR_SHOPPER_REFERENCE");
// Make the request
PaymentLinksApi service = new PaymentLinksApi(client);
PaymentLinkResponse response = service.paymentLinks(paymentLinkRequest, new RequestOptions().idempotencyKey("UUID"));
// Adyen PHP API Library v17.4.0
use Adyen\Client;
use Adyen\Environment;
use Adyen\Model\Checkout\LineItem;
use Adyen\Model\Checkout\Amount;
use Adyen\Model\Checkout\PaymentLinkRequest;
use Adyen\Service\Checkout\PaymentLinksApi;
$client = new Client();
$client->setXApiKey("ADYEN_API_KEY");
$client->setEnvironment(Environment::TEST);
// Request objects
$lineItem1 = new LineItem();
$lineItem1
->setQuantity(1)
->setAmountExcludingTax(331)
->setTaxPercentage(2100)
->setDescription("Shoes")
->setId("Item #1")
->setTaxAmount(69)
->setAmountIncludingTax(400);
$lineItem2 = new LineItem();
$lineItem2
->setQuantity(2)
->setAmountExcludingTax(248)
->setTaxPercentage(2100)
->setDescription("Socks")
->setId("Item #2")
->setTaxAmount(52)
->setAmountIncludingTax(300);
$amount = new Amount();
$amount
->setCurrency("SEK")
->setValue(1000);
$paymentLinkRequest = new PaymentLinkRequest();
$paymentLinkRequest
->setReference("YOUR_ORDER_NUMBER")
->setLineItems(array($lineItem1, $lineItem2))
->setAmount($amount)
->setMerchantAccount("YOUR_MERCHANT_ACCOUNT")
->setCountryCode("SE")
->setRequiredShopperFields(array("shopperName", "shopperEmail", "billingAddress"))
->setDescription("Shoes and socks")
->setShopperLocale("en-US")
->setShopperReference("YOUR_SHOPPER_REFERENCE");
$requestOptions['idempotencyKey'] = 'UUID';
// Make the request
$service = new PaymentLinksApi($client);
$response = $service->paymentLinks($paymentLinkRequest, $requestOptions);
// Adyen .net API Library v14.3.0
using Adyen;
using Environment = Adyen.Model.Environment;
using Adyen.Model;
using Adyen.Model.Checkout;
using Adyen.Service.Checkout;
var config = new Config()
{
XApiKey = "ADYEN_API_KEY",
Environment = Environment.Test
};
var client = new Client(config);
// Fill in your request objects
LineItem lineItem1 = new LineItem
{
Quantity = 1,
AmountExcludingTax = 331,
TaxPercentage = 2100,
Description = "Shoes",
Id = "Item #1",
TaxAmount = 69,
AmountIncludingTax = 400
};
LineItem lineItem2 = new LineItem
{
Quantity = 2,
AmountExcludingTax = 248,
TaxPercentage = 2100,
Description = "Socks",
Id = "Item #2",
TaxAmount = 52,
AmountIncludingTax = 300
};
Amount amount = new Amount
{
Currency = "SEK",
Value = 1000
};
PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest
{
Reference = "YOUR_ORDER_NUMBER",
LineItems = new List<LineItem>{ lineItem1, lineItem2 },
Amount = amount,
MerchantAccount = "YOUR_MERCHANT_ACCOUNT",
CountryCode = "SE",
RequiredShopperFields = { PaymentLinkRequest.RequiredShopperFieldsEnum.ShopperName,
PaymentLinkRequest.RequiredShopperFieldsEnum.ShopperEmail,
PaymentLinkRequest.RequiredShopperFieldsEnum.BillingAddress },
Description = "Shoes and socks",
ShopperLocale = "en-US",
ShopperReference = "YOUR_SHOPPER_REFERENCE"
};
// Make the request
var service = new PaymentLinksService(client);
var response = service.PaymentLinks(paymentLinkRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"});
// Adyen Node API Library v16.2.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: "ADYEN_API_KEY", environment: "TEST"});
// Create the request object
const paymentLinkRequest = {
reference: "YOUR_ORDER_NUMBER",
amount: {
value: 1000,
currency: "SEK"
},
description: "Shoes and socks",
countryCode: "SE",
merchantAccount: "YOUR_MERCHANT_ACCOUNT",
shopperReference: "YOUR_SHOPPER_REFERENCE",
requiredShopperFields: [ "shopperName", "shopperEmail", "billingAddress" ],
shopperLocale: "en-US",
lineItems: [ {
quantity: "1",
amountExcludingTax: "331",
taxPercentage: "2100",
description: "Shoes",
id: "Item #1",
taxAmount: "69",
amountIncludingTax: "400"
}, {
quantity: "2",
amountExcludingTax: "248",
taxPercentage: "2100",
description: "Socks",
id: "Item #2",
taxAmount: "52",
amountIncludingTax: "300"
} ]
}
// Make the request
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentLinksApi.paymentLinks(paymentLinkRequest, { idempotencyKey: "UUID" });
// Adyen Go API Library v9.2.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"
)
client := adyen.NewClient(&common.Config{
ApiKey: "ADYEN_API_KEY",
Environment: common.TestEnv,
})
// Fill in your request objects
lineItem1 := checkout.LineItem{
Quantity: common.PtrInt64(1),
AmountExcludingTax: common.PtrInt64(331),
TaxPercentage: common.PtrInt64(2100),
Description: common.PtrString("Shoes"),
Id: common.PtrString("Item #1"),
TaxAmount: common.PtrInt64(69),
AmountIncludingTax: common.PtrInt64(400),
}
lineItem2 := checkout.LineItem{
Quantity: common.PtrInt64(2),
AmountExcludingTax: common.PtrInt64(248),
TaxPercentage: common.PtrInt64(2100),
Description: common.PtrString("Socks"),
Id: common.PtrString("Item #2"),
TaxAmount: common.PtrInt64(52),
AmountIncludingTax: common.PtrInt64(300),
}
amount := checkout.Amount{
Currency: "SEK",
Value: 1000,
}
paymentLinkRequest := checkout.PaymentLinkRequest{
Reference: "YOUR_ORDER_NUMBER",
LineItems: []checkout.LineItem{
lineItem1, lineItem2,
},
Amount: amount,
MerchantAccount: "YOUR_MERCHANT_ACCOUNT",
CountryCode: common.PtrString("SE"),
RequiredShopperFields: []string{
"shopperName", "shopperEmail", "billingAddress",
},
Description: common.PtrString("Shoes and socks"),
ShopperLocale: common.PtrString("en-US"),
ShopperReference: common.PtrString("YOUR_SHOPPER_REFERENCE"),
}
// Make the request
service := client.Checkout()
req := service.PaymentLinksApi.PaymentLinksInput().IdempotencyKey("UUID").PaymentLinkRequest(paymentLinkRequest)
res, httpRes, err := service.PaymentLinksApi.PaymentLinks(context.Background(), req)
# Adyen Python API Library v12.2.0
import Adyen
adyen = Adyen.Adyen()
adyen.client.xapikey = "ADYEN_API_KEY"
adyen.client.platform = "test" # The environment to use library in.
json_request = {
"reference": "YOUR_ORDER_NUMBER",
"amount": {
"value": 1000,
"currency": "SEK"
},
"description": "Shoes and socks",
"countryCode": "SE",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"shopperReference": "YOUR_SHOPPER_REFERENCE",
"requiredShopperFields": [ "shopperName", "shopperEmail", "billingAddress" ],
"shopperLocale": "en-US",
"lineItems": [ {
"quantity": "1",
"amountExcludingTax": "331",
"taxPercentage": "2100",
"description": "Shoes",
"id": "Item #1",
"taxAmount": "69",
"amountIncludingTax": "400"
}, {
"quantity": "2",
"amountExcludingTax": "248",
"taxPercentage": "2100",
"description": "Socks",
"id": "Item #2",
"taxAmount": "52",
"amountIncludingTax": "300"
} ]
}
result = adyen.checkout.payment_links_api.payment_links(request=json_request, idempotency_key="UUID")
# Adyen Ruby API Library v9.2.0
require "adyen-ruby-api-library"
adyen = Adyen::Client.new
adyen.api_key = 'ADYEN_API_KEY'
adyen.env = :test # Set to "live" for live environment
request_body = {
:reference => 'YOUR_ORDER_NUMBER',
:amount => {
:value => 1000,
:currency => 'SEK'
},
:description => 'Shoes and socks',
:countryCode => 'SE',
:merchantAccount => 'YOUR_MERCHANT_ACCOUNT',
:shopperReference => 'YOUR_SHOPPER_REFERENCE',
:requiredShopperFields => [ 'shopperName', 'shopperEmail', 'billingAddress' ],
:shopperLocale => 'en-US',
:lineItems => [ {
:quantity => '1',
:amountExcludingTax => '331',
:taxPercentage => '2100',
:description => 'Shoes',
:id => 'Item #1',
:taxAmount => '69',
:amountIncludingTax => '400'
}, {
:quantity => '2',
:amountExcludingTax => '248',
:taxPercentage => '2100',
:description => 'Socks',
:id => 'Item #2',
:taxAmount => '52',
:amountIncludingTax => '300'
} ]
}
result = adyen.checkout.payment_links_api.payment_links(request_body, headers: { 'Idempotency-Key' => 'UUID' })
// Adyen Node API Library v16.2.0
// Require the parts of the module you want to use
import { Client, CheckoutAPI, Types } from "@adyen/api-library";
// Initialize the client object
const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});
// Create the request objects
const lineItem1: Types.checkout.LineItem = {
quantity: 1,
amountExcludingTax: 331,
taxPercentage: 2100,
description: "Shoes",
id: "Item #1",
taxAmount: 69,
amountIncludingTax: 400
};
const lineItem2: Types.checkout.LineItem = {
quantity: 2,
amountExcludingTax: 248,
taxPercentage: 2100,
description: "Socks",
id: "Item #2",
taxAmount: 52,
amountIncludingTax: 300
};
const amount: Types.checkout.Amount = {
currency: "SEK",
value: 1000
};
const paymentLinkRequest: Types.checkout.PaymentLinkRequest = {
reference: "YOUR_ORDER_NUMBER",
lineItems: [lineItem1, lineItem2],
amount: amount,
merchantAccount: "YOUR_MERCHANT_ACCOUNT",
countryCode: "SE",
requiredShopperFields: [
Types.checkout.PaymentLinkRequest.RequiredShopperFieldsEnum.ShopperName,
Types.checkout.PaymentLinkRequest.RequiredShopperFieldsEnum.ShopperEmail,
Types.checkout.PaymentLinkRequest.RequiredShopperFieldsEnum.BillingAddress
],
description: "Shoes and socks",
shopperLocale: "en-US",
shopperReference: "YOUR_SHOPPER_REFERENCE"
};
// Make the request
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentLinksApi.paymentLinks(paymentLinkRequest, { idempotencyKey: "UUID" });
The following example shows how to create a payment link that can support Klarna if you have already collected the shopper’s email, name, and address:Create payment link with additional shopper informationThe response returns the payment link details with the updated
curl https://checkout-test.adyen.com/v68/paymentLinks \
-H'x-api-key: ADYEN_API_KEY' \
-H 'content-type: application/json' \
-d '{
"reference": "YOUR_ORDER_NUMBER",
"amount": {
"value": 1000,
"currency": "SEK"
},
"description": "Shoes and socks",
"countryCode": "SE",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"shopperReference": "YOUR_SHOPPER_REFERENCE",
"shopperName":{
"firstName":"Testperson-se",
"lastName":"Approved"
},
"shopperEmail": "s.hopper@example.com",
"shopperLocale": "en-US",
"billingAddress":{
"city":"Ankeborg",
"country":"SE",
"houseNumberOrName":"1",
"postalCode":"12345",
"street":"Stargatan"
},
"lineItems":[
{
"quantity":"1",
"amountExcludingTax":"331",
"taxPercentage":"2100",
"description":"Shoes",
"id":"Item #1",
"taxAmount":"69",
"amountIncludingTax":"400"
},
{
"quantity":"2",
"amountExcludingTax":"248",
"taxPercentage":"2100",
"description":"Socks",
"id":"Item #2",
"taxAmount":"52",
"amountIncludingTax":"300"
}
]
}'
// Adyen Java API Library v25.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.*;
Client client = new Client("ADYEN_API_KEY", Environment.TEST);
// Request objects
LineItem lineItem1 = new LineItem()
.quantity(1L)
.amountExcludingTax(331L)
.taxPercentage(2100L)
.description("Shoes")
.id("Item #1")
.taxAmount(69L)
.amountIncludingTax(400L);
LineItem lineItem2 = new LineItem()
.quantity(2L)
.amountExcludingTax(248L)
.taxPercentage(2100L)
.description("Socks")
.id("Item #2")
.taxAmount(52L)
.amountIncludingTax(300L);
Amount amount = new Amount()
.currency("SEK")
.value(1000L);
Name name = new Name()
.firstName("Testperson-se")
.lastName("Approved");
Address address = new Address()
.country("SE")
.city("Ankeborg")
.houseNumberOrName("1")
.street("Stargatan")
.postalCode("12345");
PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest()
.reference("YOUR_ORDER_NUMBER")
.lineItems(Arrays.asList(lineItem1, lineItem2))
.amount(amount)
.shopperName(name)
.merchantAccount("YOUR_MERCHANT_ACCOUNT")
.countryCode("SE")
.description("Shoes and socks")
.shopperEmail("s.hopper@example.com")
.shopperLocale("en-US")
.billingAddress(address)
.shopperReference("YOUR_SHOPPER_REFERENCE");
// Make the request
PaymentLinksApi service = new PaymentLinksApi(client);
PaymentLinkResponse response = service.paymentLinks(paymentLinkRequest, new RequestOptions().idempotencyKey("UUID"));
// Adyen PHP API Library v17.4.0
use Adyen\Client;
use Adyen\Environment;
use Adyen\Model\Checkout\LineItem;
use Adyen\Model\Checkout\Amount;
use Adyen\Model\Checkout\Name;
use Adyen\Model\Checkout\Address;
use Adyen\Model\Checkout\PaymentLinkRequest;
use Adyen\Service\Checkout\PaymentLinksApi;
$client = new Client();
$client->setXApiKey("ADYEN_API_KEY");
$client->setEnvironment(Environment::TEST);
// Request objects
$lineItem1 = new LineItem();
$lineItem1
->setQuantity(1)
->setAmountExcludingTax(331)
->setTaxPercentage(2100)
->setDescription("Shoes")
->setId("Item #1")
->setTaxAmount(69)
->setAmountIncludingTax(400);
$lineItem2 = new LineItem();
$lineItem2
->setQuantity(2)
->setAmountExcludingTax(248)
->setTaxPercentage(2100)
->setDescription("Socks")
->setId("Item #2")
->setTaxAmount(52)
->setAmountIncludingTax(300);
$amount = new Amount();
$amount
->setCurrency("SEK")
->setValue(1000);
$name = new Name();
$name
->setFirstName("Testperson-se")
->setLastName("Approved");
$address = new Address();
$address
->setCountry("SE")
->setCity("Ankeborg")
->setHouseNumberOrName("1")
->setStreet("Stargatan")
->setPostalCode("12345");
$paymentLinkRequest = new PaymentLinkRequest();
$paymentLinkRequest
->setReference("YOUR_ORDER_NUMBER")
->setLineItems(array($lineItem1, $lineItem2))
->setAmount($amount)
->setShopperName($name)
->setMerchantAccount("YOUR_MERCHANT_ACCOUNT")
->setCountryCode("SE")
->setDescription("Shoes and socks")
->setShopperEmail("s.hopper@example.com")
->setShopperLocale("en-US")
->setBillingAddress($address)
->setShopperReference("YOUR_SHOPPER_REFERENCE");
$requestOptions['idempotencyKey'] = 'UUID';
// Make the request
$service = new PaymentLinksApi($client);
$response = $service->paymentLinks($paymentLinkRequest, $requestOptions);
// Adyen .net API Library v14.3.0
using Adyen;
using Environment = Adyen.Model.Environment;
using Adyen.Model;
using Adyen.Model.Checkout;
using Adyen.Service.Checkout;
var config = new Config()
{
XApiKey = "ADYEN_API_KEY",
Environment = Environment.Test
};
var client = new Client(config);
// Fill in your request objects
LineItem lineItem1 = new LineItem
{
Quantity = 1,
AmountExcludingTax = 331,
TaxPercentage = 2100,
Description = "Shoes",
Id = "Item #1",
TaxAmount = 69,
AmountIncludingTax = 400
};
LineItem lineItem2 = new LineItem
{
Quantity = 2,
AmountExcludingTax = 248,
TaxPercentage = 2100,
Description = "Socks",
Id = "Item #2",
TaxAmount = 52,
AmountIncludingTax = 300
};
Amount amount = new Amount
{
Currency = "SEK",
Value = 1000
};
Name name = new Name
{
FirstName = "Testperson-se",
LastName = "Approved"
};
Address address = new Address
{
Country = "SE",
City = "Ankeborg",
HouseNumberOrName = "1",
Street = "Stargatan",
PostalCode = "12345"
};
PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest
{
Reference = "YOUR_ORDER_NUMBER",
LineItems = new List<LineItem>{ lineItem1, lineItem2 },
Amount = amount,
ShopperName = name,
MerchantAccount = "YOUR_MERCHANT_ACCOUNT",
CountryCode = "SE",
Description = "Shoes and socks",
ShopperEmail = "s.hopper@example.com",
ShopperLocale = "en-US",
BillingAddress = address,
ShopperReference = "YOUR_SHOPPER_REFERENCE"
};
// Make the request
var service = new PaymentLinksService(client);
var response = service.PaymentLinks(paymentLinkRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"});
// Adyen Node API Library v16.2.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: "ADYEN_API_KEY", environment: "TEST"});
// Create the request object
const paymentLinkRequest = {
reference: "YOUR_ORDER_NUMBER",
amount: {
value: 1000,
currency: "SEK"
},
description: "Shoes and socks",
countryCode: "SE",
merchantAccount: "YOUR_MERCHANT_ACCOUNT",
shopperReference: "YOUR_SHOPPER_REFERENCE",
shopperName: {
firstName: "Testperson-se",
lastName: "Approved"
},
shopperEmail: "s.hopper@example.com",
shopperLocale: "en-US",
billingAddress: {
city: "Ankeborg",
country: "SE",
houseNumberOrName: "1",
postalCode: "12345",
street: "Stargatan"
},
lineItems: [ {
quantity: "1",
amountExcludingTax: "331",
taxPercentage: "2100",
description: "Shoes",
id: "Item #1",
taxAmount: "69",
amountIncludingTax: "400"
}, {
quantity: "2",
amountExcludingTax: "248",
taxPercentage: "2100",
description: "Socks",
id: "Item #2",
taxAmount: "52",
amountIncludingTax: "300"
} ]
}
// Make the request
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentLinksApi.paymentLinks(paymentLinkRequest, { idempotencyKey: "UUID" });
// Adyen Go API Library v9.2.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"
)
client := adyen.NewClient(&common.Config{
ApiKey: "ADYEN_API_KEY",
Environment: common.TestEnv,
})
// Fill in your request objects
lineItem1 := checkout.LineItem{
Quantity: common.PtrInt64(1),
AmountExcludingTax: common.PtrInt64(331),
TaxPercentage: common.PtrInt64(2100),
Description: common.PtrString("Shoes"),
Id: common.PtrString("Item #1"),
TaxAmount: common.PtrInt64(69),
AmountIncludingTax: common.PtrInt64(400),
}
lineItem2 := checkout.LineItem{
Quantity: common.PtrInt64(2),
AmountExcludingTax: common.PtrInt64(248),
TaxPercentage: common.PtrInt64(2100),
Description: common.PtrString("Socks"),
Id: common.PtrString("Item #2"),
TaxAmount: common.PtrInt64(52),
AmountIncludingTax: common.PtrInt64(300),
}
amount := checkout.Amount{
Currency: "SEK",
Value: 1000,
}
name := checkout.Name{
FirstName: "Testperson-se",
LastName: "Approved",
}
address := checkout.Address{
Country: "SE",
City: "Ankeborg",
HouseNumberOrName: "1",
Street: "Stargatan",
PostalCode: "12345",
}
paymentLinkRequest := checkout.PaymentLinkRequest{
Reference: "YOUR_ORDER_NUMBER",
LineItems: []checkout.LineItem{
lineItem1, lineItem2,
},
Amount: amount,
ShopperName: &name,
MerchantAccount: "YOUR_MERCHANT_ACCOUNT",
CountryCode: common.PtrString("SE"),
Description: common.PtrString("Shoes and socks"),
ShopperEmail: common.PtrString("s.hopper@example.com"),
ShopperLocale: common.PtrString("en-US"),
BillingAddress: &address,
ShopperReference: common.PtrString("YOUR_SHOPPER_REFERENCE"),
}
// Make the request
service := client.Checkout()
req := service.PaymentLinksApi.PaymentLinksInput().IdempotencyKey("UUID").PaymentLinkRequest(paymentLinkRequest)
res, httpRes, err := service.PaymentLinksApi.PaymentLinks(context.Background(), req)
# Adyen Python API Library v12.2.0
import Adyen
adyen = Adyen.Adyen()
adyen.client.xapikey = "ADYEN_API_KEY"
adyen.client.platform = "test" # The environment to use library in.
json_request = {
"reference": "YOUR_ORDER_NUMBER",
"amount": {
"value": 1000,
"currency": "SEK"
},
"description": "Shoes and socks",
"countryCode": "SE",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"shopperReference": "YOUR_SHOPPER_REFERENCE",
"shopperName": {
"firstName": "Testperson-se",
"lastName": "Approved"
},
"shopperEmail": "s.hopper@example.com",
"shopperLocale": "en-US",
"billingAddress": {
"city": "Ankeborg",
"country": "SE",
"houseNumberOrName": "1",
"postalCode": "12345",
"street": "Stargatan"
},
"lineItems": [ {
"quantity": "1",
"amountExcludingTax": "331",
"taxPercentage": "2100",
"description": "Shoes",
"id": "Item #1",
"taxAmount": "69",
"amountIncludingTax": "400"
}, {
"quantity": "2",
"amountExcludingTax": "248",
"taxPercentage": "2100",
"description": "Socks",
"id": "Item #2",
"taxAmount": "52",
"amountIncludingTax": "300"
} ]
}
result = adyen.checkout.payment_links_api.payment_links(request=json_request, idempotency_key="UUID")
# Adyen Ruby API Library v9.2.0
require "adyen-ruby-api-library"
adyen = Adyen::Client.new
adyen.api_key = 'ADYEN_API_KEY'
adyen.env = :test # Set to "live" for live environment
request_body = {
:reference => 'YOUR_ORDER_NUMBER',
:amount => {
:value => 1000,
:currency => 'SEK'
},
:description => 'Shoes and socks',
:countryCode => 'SE',
:merchantAccount => 'YOUR_MERCHANT_ACCOUNT',
:shopperReference => 'YOUR_SHOPPER_REFERENCE',
:shopperName => {
:firstName => 'Testperson-se',
:lastName => 'Approved'
},
:shopperEmail => 's.hopper@example.com',
:shopperLocale => 'en-US',
:billingAddress => {
:city => 'Ankeborg',
:country => 'SE',
:houseNumberOrName => '1',
:postalCode => '12345',
:street => 'Stargatan'
},
:lineItems => [ {
:quantity => '1',
:amountExcludingTax => '331',
:taxPercentage => '2100',
:description => 'Shoes',
:id => 'Item #1',
:taxAmount => '69',
:amountIncludingTax => '400'
}, {
:quantity => '2',
:amountExcludingTax => '248',
:taxPercentage => '2100',
:description => 'Socks',
:id => 'Item #2',
:taxAmount => '52',
:amountIncludingTax => '300'
} ]
}
result = adyen.checkout.payment_links_api.payment_links(request_body, headers: { 'Idempotency-Key' => 'UUID' })
// Adyen Node API Library v16.2.0
// Require the parts of the module you want to use
import { Client, CheckoutAPI, Types } from "@adyen/api-library";
// Initialize the client object
const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});
// Create the request objects
const lineItem1: Types.checkout.LineItem = {
quantity: 1,
amountExcludingTax: 331,
taxPercentage: 2100,
description: "Shoes",
id: "Item #1",
taxAmount: 69,
amountIncludingTax: 400
};
const lineItem2: Types.checkout.LineItem = {
quantity: 2,
amountExcludingTax: 248,
taxPercentage: 2100,
description: "Socks",
id: "Item #2",
taxAmount: 52,
amountIncludingTax: 300
};
const amount: Types.checkout.Amount = {
currency: "SEK",
value: 1000
};
const name: Types.checkout.Name = {
firstName: "Testperson-se",
lastName: "Approved"
};
const address: Types.checkout.Address = {
country: "SE",
city: "Ankeborg",
houseNumberOrName: "1",
street: "Stargatan",
postalCode: "12345"
};
const paymentLinkRequest: Types.checkout.PaymentLinkRequest = {
reference: "YOUR_ORDER_NUMBER",
lineItems: [lineItem1, lineItem2],
amount: amount,
shopperName: name,
merchantAccount: "YOUR_MERCHANT_ACCOUNT",
countryCode: "SE",
description: "Shoes and socks",
shopperEmail: "s.hopper@example.com",
shopperLocale: "en-US",
billingAddress: address,
shopperReference: "YOUR_SHOPPER_REFERENCE"
};
// Make the request
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentLinksApi.paymentLinks(paymentLinkRequest, { idempotencyKey: "UUID" });
Force the expiry of a payment link
In some scenarios, you may want to force the expiry of a payment link. For example, if a shopper updates their order after you have sent them a payment link, you may want to create a new payment link with the updated amount. To avoid confusion with two payment links, set thestatus of the previous payment link to expired. Changing the status to expired also changes the payment link’s expiry date to the current date and time.To force the expiry, make a PATCH /paymentLinks/{linkId} request and update the status.Force the expiry of a payment linkcurl https://checkout-test.adyen.com/v68/paymentLinks/PL50C5F751CED39G71 \
-H 'x-api-key: ADYEN_API_KEY' \
-H 'content-type: application/json' \
-X PATCH \
-d '{
"status": "expired"
}'
// Adyen Java API Library v25.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.service.checkout.*;
Client client = new Client("ADYEN_API_KEY", Environment.TEST);
// Request objects
UpdatePaymentLinkRequest updatePaymentLinkRequest = new UpdatePaymentLinkRequest()
.status(UpdatePaymentLinkRequest.StatusEnum.EXPIRED);
// Make the request
PaymentLinksApi service = new PaymentLinksApi(client);
PaymentLinkResponse response = service.updatePaymentLink("linkId", updatePaymentLinkRequest, null);
// Adyen PHP API Library v17.4.0
use Adyen\Client;
use Adyen\Environment;
use Adyen\Model\Checkout\UpdatePaymentLinkRequest;
use Adyen\Service\Checkout\PaymentLinksApi;
$client = new Client();
$client->setXApiKey("ADYEN_API_KEY");
$client->setEnvironment(Environment::TEST);
// Request objects
$updatePaymentLinkRequest = new UpdatePaymentLinkRequest();
$updatePaymentLinkRequest
->setStatus("expired");
// Make the request
$service = new PaymentLinksApi($client);
$response = $service->updatePaymentLink('linkId', $updatePaymentLinkRequest);
// Adyen .net API Library v14.3.0
using Adyen;
using Environment = Adyen.Model.Environment;
using Adyen.Model;
using Adyen.Model.Checkout;
using Adyen.Service.Checkout;
var config = new Config()
{
XApiKey = "ADYEN_API_KEY",
Environment = Environment.Test
};
var client = new Client(config);
// Fill in your request objects
UpdatePaymentLinkRequest updatePaymentLinkRequest = new UpdatePaymentLinkRequest
{
Status = UpdatePaymentLinkRequest.StatusEnum.Expired
};
// Make the request
var service = new PaymentLinksService(client);
var response = service.UpdatePaymentLink("linkId", updatePaymentLinkRequest);
// Adyen Node API Library v16.2.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: "ADYEN_API_KEY", environment: "TEST"});
// Create the request object
const updatePaymentLinkRequest = {
status: "expired"
}
// Make the request
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentLinksApi.updatePaymentLink("linkId", updatePaymentLinkRequest);
// Adyen Go API Library v9.2.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"
)
client := adyen.NewClient(&common.Config{
ApiKey: "ADYEN_API_KEY",
Environment: common.TestEnv,
})
// Fill in your request objects
updatePaymentLinkRequest := checkout.UpdatePaymentLinkRequest{
Status: "expired",
}
// Make the request
service := client.Checkout()
req := service.PaymentLinksApi.UpdatePaymentLinkInput("linkId").UpdatePaymentLinkRequest(updatePaymentLinkRequest)
res, httpRes, err := service.PaymentLinksApi.UpdatePaymentLink(context.Background(), req)
# Adyen Python API Library v12.2.0
import Adyen
adyen = Adyen.Adyen()
adyen.client.xapikey = "ADYEN_API_KEY"
adyen.client.platform = "test" # The environment to use library in.
json_request = {
"status": "expired"
}
result = adyen.checkout.payment_links_api.update_payment_link(request=json_request, linkId="linkId")
# Adyen Ruby API Library v9.2.0
require "adyen-ruby-api-library"
adyen = Adyen::Client.new
adyen.api_key = 'ADYEN_API_KEY'
adyen.env = :test # Set to "live" for live environment
request_body = {
:status => 'expired'
}
result = adyen.checkout.payment_links_api.update_payment_link(request_body, 'linkId')
// Adyen Node API Library v16.2.0
// Require the parts of the module you want to use
import { Client, CheckoutAPI, Types } from "@adyen/api-library";
// Initialize the client object
const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});
// Create the request objects
const updatePaymentLinkRequest: Types.checkout.UpdatePaymentLinkRequest = {
status: Types.checkout.UpdatePaymentLinkRequest.StatusEnum.Expired
};
// Make the request
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentLinksApi.updatePaymentLink("linkId", updatePaymentLinkRequest);
status and expiresAt parameters.Response{
"amount": {
"currency": "EUR",
"value": 4200
},
"countryCode": "NL",
"expiresAt": "2020-06-23T13:10:33Z",
"id": "PL50C5F751CED39G71",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"reference": "YOUR_PAYMENT_REFERENCE",
"shopperLocale": "nl-NL",
"status": "expired",
"url": "https://test.adyen.link/PL50C5F751CED39G71"
}
Customize the payment page
Learn how to customize:- Which payment methods are shown on the payment page, and in which order.
- The appearance of the payment page, using themes.
- The language shown on the payment page.
Payment methods
The payment methods are ordered by popularity, the most popular payment methods in the shopper’s country/region appearing at the top.In your Customer Area, you can configure which payment methods are rendered based on the shopper’s country/region. If you want to customize payment methods for specific transactions, you can do this by including additional parameters in your API request.Customize based on shopper’s country/region
To configure payment methods in your Customer Area, you must have the Change payment methods user role.To configure which payment methods are rendered (and in which order) based on the shopper’s country/region:- Log in to your Customer Area.
- Go to Settings > Checkout settings.
- Select a Shopper country/region.
- Drag the payment methods into the order you want them to appear to shoppers in this country/region.
- To hide a payment method from shoppers in this country/region, drag it to the Other configured payment methods box.
Customize for specific transactions
When making a POST /paymentLinks request, you can include one of the following parameters:- allowedPaymentMethods: only payment methods that you specify here will be rendered on the payment page.
- blockedPaymentMethods: payment methods that you specify here will not be rendered on the payment page.
paymentMethodVariant .Here is an example of how you can create a payment link that only allows the shopper to pay with iDEAL or card:Create a payment link with customized list of payment methodscurl https://checkout-test.adyen.com/v68/paymentLinks \
-H'x-api-key: ADYEN_API_KEY' \
-H 'content-type: application/json' \
-d '{
"allowedPaymentMethods": ["ideal","scheme"],
"reference": "YOUR_PAYMENT_REFERENCE",
"amount": {
"value": 1000,
"currency": "EUR"
},
"countryCode": "NL",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"shopperLocale": "nl-NL"
}'
// Adyen Java API Library v25.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.*;
Client client = new Client("ADYEN_API_KEY", Environment.TEST);
// Request objects
Amount amount = new Amount()
.currency("EUR")
.value(1000L);
PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest()
.reference("YOUR_PAYMENT_REFERENCE")
.amount(amount)
.merchantAccount("YOUR_MERCHANT_ACCOUNT")
.countryCode("NL")
.shopperLocale("nl-NL")
.allowedPaymentMethods(Arrays.asList("ideal", "scheme"));
// Make the request
PaymentLinksApi service = new PaymentLinksApi(client);
PaymentLinkResponse response = service.paymentLinks(paymentLinkRequest, new RequestOptions().idempotencyKey("UUID"));
// Adyen PHP API Library v17.4.0
use Adyen\Client;
use Adyen\Environment;
use Adyen\Model\Checkout\Amount;
use Adyen\Model\Checkout\PaymentLinkRequest;
use Adyen\Service\Checkout\PaymentLinksApi;
$client = new Client();
$client->setXApiKey("ADYEN_API_KEY");
$client->setEnvironment(Environment::TEST);
// Request objects
$amount = new Amount();
$amount
->setCurrency("EUR")
->setValue(1000);
$paymentLinkRequest = new PaymentLinkRequest();
$paymentLinkRequest
->setReference("YOUR_PAYMENT_REFERENCE")
->setAmount($amount)
->setMerchantAccount("YOUR_MERCHANT_ACCOUNT")
->setCountryCode("NL")
->setShopperLocale("nl-NL")
->setAllowedPaymentMethods(array("ideal", "scheme"));
$requestOptions['idempotencyKey'] = 'UUID';
// Make the request
$service = new PaymentLinksApi($client);
$response = $service->paymentLinks($paymentLinkRequest, $requestOptions);
// Adyen .net API Library v14.3.0
using Adyen;
using Environment = Adyen.Model.Environment;
using Adyen.Model;
using Adyen.Model.Checkout;
using Adyen.Service.Checkout;
var config = new Config()
{
XApiKey = "ADYEN_API_KEY",
Environment = Environment.Test
};
var client = new Client(config);
// Fill in your request objects
Amount amount = new Amount
{
Currency = "EUR",
Value = 1000
};
PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest
{
Reference = "YOUR_PAYMENT_REFERENCE",
Amount = amount,
MerchantAccount = "YOUR_MERCHANT_ACCOUNT",
CountryCode = "NL",
ShopperLocale = "nl-NL",
AllowedPaymentMethods = { "ideal", "scheme" }
};
// Make the request
var service = new PaymentLinksService(client);
var response = service.PaymentLinks(paymentLinkRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"});
// Adyen Node API Library v16.2.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: "ADYEN_API_KEY", environment: "TEST"});
// Create the request object
const paymentLinkRequest = {
allowedPaymentMethods: [ "ideal", "scheme" ],
reference: "YOUR_PAYMENT_REFERENCE",
amount: {
value: 1000,
currency: "EUR"
},
countryCode: "NL",
merchantAccount: "YOUR_MERCHANT_ACCOUNT",
shopperLocale: "nl-NL"
}
// Make the request
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentLinksApi.paymentLinks(paymentLinkRequest, { idempotencyKey: "UUID" });
// Adyen Go API Library v9.2.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"
)
client := adyen.NewClient(&common.Config{
ApiKey: "ADYEN_API_KEY",
Environment: common.TestEnv,
})
// Fill in your request objects
amount := checkout.Amount{
Currency: "EUR",
Value: 1000,
}
paymentLinkRequest := checkout.PaymentLinkRequest{
Reference: "YOUR_PAYMENT_REFERENCE",
Amount: amount,
MerchantAccount: "YOUR_MERCHANT_ACCOUNT",
CountryCode: common.PtrString("NL"),
ShopperLocale: common.PtrString("nl-NL"),
AllowedPaymentMethods: []string{
"ideal", "scheme",
},
}
// Make the request
service := client.Checkout()
req := service.PaymentLinksApi.PaymentLinksInput().IdempotencyKey("UUID").PaymentLinkRequest(paymentLinkRequest)
res, httpRes, err := service.PaymentLinksApi.PaymentLinks(context.Background(), req)
# Adyen Python API Library v12.2.0
import Adyen
adyen = Adyen.Adyen()
adyen.client.xapikey = "ADYEN_API_KEY"
adyen.client.platform = "test" # The environment to use library in.
json_request = {
"allowedPaymentMethods": [ "ideal", "scheme" ],
"reference": "YOUR_PAYMENT_REFERENCE",
"amount": {
"value": 1000,
"currency": "EUR"
},
"countryCode": "NL",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"shopperLocale": "nl-NL"
}
result = adyen.checkout.payment_links_api.payment_links(request=json_request, idempotency_key="UUID")
# Adyen Ruby API Library v9.2.0
require "adyen-ruby-api-library"
adyen = Adyen::Client.new
adyen.api_key = 'ADYEN_API_KEY'
adyen.env = :test # Set to "live" for live environment
request_body = {
:allowedPaymentMethods => [ 'ideal', 'scheme' ],
:reference => 'YOUR_PAYMENT_REFERENCE',
:amount => {
:value => 1000,
:currency => 'EUR'
},
:countryCode => 'NL',
:merchantAccount => 'YOUR_MERCHANT_ACCOUNT',
:shopperLocale => 'nl-NL'
}
result = adyen.checkout.payment_links_api.payment_links(request_body, headers: { 'Idempotency-Key' => 'UUID' })
// Adyen Node API Library v16.2.0
// Require the parts of the module you want to use
import { Client, CheckoutAPI, Types } from "@adyen/api-library";
// Initialize the client object
const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});
// Create the request objects
const amount: Types.checkout.Amount = {
currency: "EUR",
value: 1000
};
const paymentLinkRequest: Types.checkout.PaymentLinkRequest = {
reference: "YOUR_PAYMENT_REFERENCE",
amount: amount,
merchantAccount: "YOUR_MERCHANT_ACCOUNT",
countryCode: "NL",
shopperLocale: "nl-NL",
allowedPaymentMethods: ["ideal", "scheme"]
};
// Make the request
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentLinksApi.paymentLinks(paymentLinkRequest, { idempotencyKey: "UUID" });
Themes
Themes allow you to specify a background image and a brand logo to customize the appearance of the payment page. If you create several themes, you can choose a theme when you create the payment link.Create a new theme
To create a theme, you must have one of the following user roles:- Merchant admin
- Pay by Link Settings
- Log in to your Customer Area and switch to your merchant account if necessary.
- Go to Pay by Link > Themes.
- Select Create a new theme.
- Enter a Theme name. This name is visible to the user creating the payment link in the Customer Area.
- Enter a Display name. This name is visible to the shopper.
- Upload a favicon.
- Upload a brand logo.
- If you want this theme to be the default theme for all payment links, select Set as default. Available only on the merchant account.
- Select Create.
Create a payment link with a specific theme
After the theme has been created, you see a Theme ID on the Customer Area page for that theme. To use the theme for a new payment link, include thethemeId in your POST /paymentLinks request.Here is an example of how you can create a payment link with a theme:Create a payment link with a themecurl https://checkout-test.adyen.com/v68/paymentLinks \
-H'x-api-key: ADYEN_API_KEY' \
-H 'content-type: application/json' \
-d '{
"themeId": "eccbbbc3-b880-430a-8093-6685aba887cf",
"reference": "YOUR_PAYMENT_REFERENCE",
"amount": {
"value": 1000,
"currency": "EUR"
},
"countryCode": "NL",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"shopperLocale": "nl-NL"
}'
// Adyen Java API Library v25.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.*;
Client client = new Client("ADYEN_API_KEY", Environment.TEST);
// Request objects
Amount amount = new Amount()
.currency("EUR")
.value(1000L);
PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest()
.reference("YOUR_PAYMENT_REFERENCE")
.amount(amount)
.merchantAccount("YOUR_MERCHANT_ACCOUNT")
.countryCode("NL")
.themeId("eccbbbc3-b880-430a-8093-6685aba887cf")
.shopperLocale("nl-NL");
// Make the request
PaymentLinksApi service = new PaymentLinksApi(client);
PaymentLinkResponse response = service.paymentLinks(paymentLinkRequest, new RequestOptions().idempotencyKey("UUID"));
// Adyen PHP API Library v17.4.0
use Adyen\Client;
use Adyen\Environment;
use Adyen\Model\Checkout\Amount;
use Adyen\Model\Checkout\PaymentLinkRequest;
use Adyen\Service\Checkout\PaymentLinksApi;
$client = new Client();
$client->setXApiKey("ADYEN_API_KEY");
$client->setEnvironment(Environment::TEST);
// Request objects
$amount = new Amount();
$amount
->setCurrency("EUR")
->setValue(1000);
$paymentLinkRequest = new PaymentLinkRequest();
$paymentLinkRequest
->setReference("YOUR_PAYMENT_REFERENCE")
->setAmount($amount)
->setMerchantAccount("YOUR_MERCHANT_ACCOUNT")
->setCountryCode("NL")
->setThemeId("eccbbbc3-b880-430a-8093-6685aba887cf")
->setShopperLocale("nl-NL");
$requestOptions['idempotencyKey'] = 'UUID';
// Make the request
$service = new PaymentLinksApi($client);
$response = $service->paymentLinks($paymentLinkRequest, $requestOptions);
// Adyen .net API Library v14.3.0
using Adyen;
using Environment = Adyen.Model.Environment;
using Adyen.Model;
using Adyen.Model.Checkout;
using Adyen.Service.Checkout;
var config = new Config()
{
XApiKey = "ADYEN_API_KEY",
Environment = Environment.Test
};
var client = new Client(config);
// Fill in your request objects
Amount amount = new Amount
{
Currency = "EUR",
Value = 1000
};
PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest
{
Reference = "YOUR_PAYMENT_REFERENCE",
Amount = amount,
MerchantAccount = "YOUR_MERCHANT_ACCOUNT",
CountryCode = "NL",
ThemeId = "eccbbbc3-b880-430a-8093-6685aba887cf",
ShopperLocale = "nl-NL"
};
// Make the request
var service = new PaymentLinksService(client);
var response = service.PaymentLinks(paymentLinkRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"});
// Adyen Node API Library v16.2.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: "ADYEN_API_KEY", environment: "TEST"});
// Create the request object
const paymentLinkRequest = {
themeId: "eccbbbc3-b880-430a-8093-6685aba887cf",
reference: "YOUR_PAYMENT_REFERENCE",
amount: {
value: 1000,
currency: "EUR"
},
countryCode: "NL",
merchantAccount: "YOUR_MERCHANT_ACCOUNT",
shopperLocale: "nl-NL"
}
// Make the request
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentLinksApi.paymentLinks(paymentLinkRequest, { idempotencyKey: "UUID" });
// Adyen Go API Library v9.2.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"
)
client := adyen.NewClient(&common.Config{
ApiKey: "ADYEN_API_KEY",
Environment: common.TestEnv,
})
// Fill in your request objects
amount := checkout.Amount{
Currency: "EUR",
Value: 1000,
}
paymentLinkRequest := checkout.PaymentLinkRequest{
Reference: "YOUR_PAYMENT_REFERENCE",
Amount: amount,
MerchantAccount: "YOUR_MERCHANT_ACCOUNT",
CountryCode: common.PtrString("NL"),
ThemeId: common.PtrString("eccbbbc3-b880-430a-8093-6685aba887cf"),
ShopperLocale: common.PtrString("nl-NL"),
}
// Make the request
service := client.Checkout()
req := service.PaymentLinksApi.PaymentLinksInput().IdempotencyKey("UUID").PaymentLinkRequest(paymentLinkRequest)
res, httpRes, err := service.PaymentLinksApi.PaymentLinks(context.Background(), req)
# Adyen Python API Library v12.2.0
import Adyen
adyen = Adyen.Adyen()
adyen.client.xapikey = "ADYEN_API_KEY"
adyen.client.platform = "test" # The environment to use library in.
json_request = {
"themeId": "eccbbbc3-b880-430a-8093-6685aba887cf",
"reference": "YOUR_PAYMENT_REFERENCE",
"amount": {
"value": 1000,
"currency": "EUR"
},
"countryCode": "NL",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"shopperLocale": "nl-NL"
}
result = adyen.checkout.payment_links_api.payment_links(request=json_request, idempotency_key="UUID")
# Adyen Ruby API Library v9.2.0
require "adyen-ruby-api-library"
adyen = Adyen::Client.new
adyen.api_key = 'ADYEN_API_KEY'
adyen.env = :test # Set to "live" for live environment
request_body = {
:themeId => 'eccbbbc3-b880-430a-8093-6685aba887cf',
:reference => 'YOUR_PAYMENT_REFERENCE',
:amount => {
:value => 1000,
:currency => 'EUR'
},
:countryCode => 'NL',
:merchantAccount => 'YOUR_MERCHANT_ACCOUNT',
:shopperLocale => 'nl-NL'
}
result = adyen.checkout.payment_links_api.payment_links(request_body, headers: { 'Idempotency-Key' => 'UUID' })
// Adyen Node API Library v16.2.0
// Require the parts of the module you want to use
import { Client, CheckoutAPI, Types } from "@adyen/api-library";
// Initialize the client object
const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});
// Create the request objects
const amount: Types.checkout.Amount = {
currency: "EUR",
value: 1000
};
const paymentLinkRequest: Types.checkout.PaymentLinkRequest = {
reference: "YOUR_PAYMENT_REFERENCE",
amount: amount,
merchantAccount: "YOUR_MERCHANT_ACCOUNT",
countryCode: "NL",
themeId: "eccbbbc3-b880-430a-8093-6685aba887cf",
shopperLocale: "nl-NL"
};
// Make the request
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentLinksApi.paymentLinks(paymentLinkRequest, { idempotencyKey: "UUID" });
Language and localization
The default language of the payment page is the language of the shopper’s browser locale. To change the language of payment page, send theshopperLocale parameter in your POST /paymentLinks request.Pay by Link supports the following languages:| Language | shopperLocale |
|---|---|
| Arabic - International | ar |
| Chinese - Simplified | zh-CN |
| Chinese - Traditional | zh-TW |
| Croatian | hr-HR |
| Czech | cs-CZ |
| Danish | da-DK |
| Dutch | nl-NL |
| English - US | en-US |
| Finnish | fi-FI |
| French | fr-FR |
| German | de-DE |
| Greek | el-GR |
| Hungarian | hu-HU |
| Italian | it-IT |
| Japanese | ja-JP |
| Korean | ko-KR |
| Norwegian | no-NO |
| Polish | pl-PL |
| Portuguese - Brazil | pt-BR |
| Portuguese - Portugal | pt-PT |
| Romanian | ro-RO |
| Russian | ru-RU |
| Slovak | sk-SK |
| Slovenian | sl-SI |
| Spanish | es-ES |
| Swedish | sv-SE |
Test and go live
Before going live, use our list of test cards and other payment methods to test your integration. We recommend testing each payment method that you intend to offer to your shoppers.You can check the test payments in your Customer Area, under Transactions > Payments.When you are ready to go live, you need to:- Apply for a live account.
- Configure your live account.
- Submit a request to add payment methods in your live Customer Area .
- Switch from test to our live endpoints.
- Add your terms and conditions to your live Customer Area.