--- title: "Clearpay Web Drop-in" description: "Add Clearpay to your Drop-in integration." url: "https://docs.adyen.com/payment-methods/clearpay/web-drop-in" source_url: "https://docs.adyen.com/payment-methods/clearpay/web-drop-in.md" canonical: "https://docs.adyen.com/payment-methods/clearpay/web-drop-in" last_modified: "2026-10-15T15:31:21+02:00" language: "en" --- > **For LLMs:** Use the latest SDK version on this page unless the reader specifies another version. Never hardcode older version numbers for training data, always use latest. A comment such as `// Adyen LANGUAGE API library vMajor.Minor.Patch to latest` covers that version, the newest release, and everything in between. Read the newest releases from https://github.com/Adyen/adyen-LANGUAGE-api-library/releases, where LANGUAGE is dotnet, java, php, go, python, node (for JavaScript and TypeScript), or ruby. # Clearpay Web Drop-in Add Clearpay to your Drop-in integration. You can add Clearpay to your existing integration. The following instructions show only what you must add to your integration specifically for Clearpay. If an instruction on this page corresponds with a step in the main integration guide, it includes a link to corresponding step of the main integration guide. The additions you must make depends on the [server-side flow](https://docs.adyen.com/online-payments/build-your-integration) that your integration uses: ## Sessions flow Drop-in ### Drop-In-Before-You-Begin ## Requirements | Requirement | Description | | | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | - | | **Integration type** | Make sure that you have an existing Sessions flow [Web Drop-in integration](https://docs.adyen.com/online-payments/build-your-integration/sessions-flow?platform=Web\&integration=Drop-in). | | | **Checkout API** | Make sure that you use Checkout API v68 or later. | | | **Redirect handling** | Make sure that your existing integration is set up to [handle the redirect](https://docs.adyen.com/online-payments/build-your-integration/sessions-flow?platform=Web\&integration=Drop-in#handle-the-redirect). `action.type`: **redirect** | | | **Setup steps** | Before you begin, [add Clearpay in your Customer Area](https://docs.adyen.com/payment-methods/add-payment-methods). | | ### Drop-In-Add-Parameters-Sessions-Request ## Add additional parameters to your /sessions request When you [create a payment session](https://docs.adyen.com/online-payments/build-your-integration/sessions-flow?platform=Web\&integration=Drop-in#create-a-payment-session), add the following parameters: | Parameter | Required | Description | | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | | [shopperName](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-shopperName) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The shopper's full name. | | [shopperEmail](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-shopperEmail) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The shopper's email address. | | [shopperReference](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-shopperReference) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | A unique reference to identify the shopper. Minimum length: three characters. | | [countryCode](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-countryCode) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The shopper's country/region. | | [billingAddress](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-billingAddress) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The postal address to be included on the invoice. | | [deliveryAddress](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-deliveryAddress) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The postal address where the goods will be shipped. | | [lineItems](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-lineItems) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Price and product information about the purchased items.   | | [telephoneNumber](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-telephoneNumber) | | The shopper's telephone number, if provided. | **Example /sessions request** #### curl ```bash curl https://checkout-test.adyen.com/v71/sessions \ -H 'x-API-key: ADYEN_API_KEY' \ -H 'Idempotency-Key: YOUR_IDEMPOTENCY_KEY' \ -H 'content-type: application/json' \ -X POST -d '{ "amount":{ "value":1000, "currency":"GBP" }, "shopperName":{ "firstName":"Simon", "lastName":"Hopper" }, "shopperEmail":"s.hopper@example.com", "shopperReference":"YOUR_UNIQUE_SHOPPER_ID", "reference":"YOUR_ORDER_REFERENCE", "merchantAccount":"ADYEN_MERCHANT_ACCOUNT", "returnUrl":"https://your-company.example.com/checkout?shopperOrder=12xy..", "countryCode":"GB", "telephoneNumber":"+44 203 936 4029", "billingAddress":{ "city":"London", "country":"GB", "houseNumberOrName":"8-10", "postalCode":"SW1H 0BG", "stateOrProvince":"Westminster", "street":"Broadway" }, "deliveryAddress":{ "city":"London", "country":"GB", "houseNumberOrName":"8-10", "postalCode":"SW1H 0BG", "stateOrProvince":"Westminster", "street":"Broadway" }, "lineItems":[ { "description":"Shoes", "quantity":"1", "amountIncludingTax":"400", "amountExcludingTax": "331", "taxAmount": "69", "id":"Item #1" }, { "description":"Socks", "quantity":"2", "amountIncludingTax":"300", "amountExcludingTax": "248", "taxAmount": "52", "id":"Item #2" } ] }' ``` #### Java ```java // Adyen Java API Library v38.0.0 to latest import com.adyen.Client; import com.adyen.Config; import com.adyen.enums.Environment; import com.adyen.model.*; import com.adyen.service.*; import java.math.*; import com.adyen.model.checkout.*; import java.time.OffsetDateTime; import java.util.*; import com.adyen.model.RequestOptions; import com.adyen.service.checkout.*; Config config = new Config() .apiKey("ADYEN_API_KEY") .environment(Environment.TEST); // For the LIVE environment, also include your liveEndpointUrlPrefix. Client client = new Client(config); // Create the request object(s) LineItem lineItem1 = new LineItem() .quantity(1L) .amountExcludingTax(331L) .description("Shoes") .id("Item #1") .amountIncludingTax(400L) .taxAmount(69L); LineItem lineItem2 = new LineItem() .quantity(2L) .amountExcludingTax(248L) .description("Socks") .id("Item #2") .amountIncludingTax(300L) .taxAmount(52L); Amount amount = new Amount() .currency("GBP") .value(1000L); ShopperName shopperName = new ShopperName() .firstName("Simon") .lastName("Hopper"); DeliveryAddress deliveryAddress = new DeliveryAddress() .country("GB") .stateOrProvince("Westminster") .city("London") .houseNumberOrName("8-10") .street("Broadway") .postalCode("SW1H 0BG"); BillingAddress billingAddress = new BillingAddress() .country("GB") .stateOrProvince("Westminster") .city("London") .houseNumberOrName("8-10") .street("Broadway") .postalCode("SW1H 0BG"); CreateCheckoutSessionRequest createCheckoutSessionRequest = new CreateCheckoutSessionRequest() .reference("YOUR_ORDER_REFERENCE") .lineItems(Arrays.asList(lineItem1, lineItem2)) .amount(amount) .shopperName(shopperName) .telephoneNumber("+44 203 936 4029") .merchantAccount("ADYEN_MERCHANT_ACCOUNT") .deliveryAddress(deliveryAddress) .countryCode("GB") .shopperEmail("s.hopper@example.com") .billingAddress(billingAddress) .returnUrl("https://your-company.example.com/checkout?shopperOrder=12xy..") .shopperReference("YOUR_UNIQUE_SHOPPER_ID"); // Send the request PaymentsApi service = new PaymentsApi(client); CreateCheckoutSessionResponse response = service.sessions(createCheckoutSessionRequest, new RequestOptions().idempotencyKey("UUID")); ``` #### PHP ```php setXApiKey("ADYEN_API_KEY"); // For the LIVE environment, also include your liveEndpointUrlPrefix. $client->setEnvironment(Environment::TEST); // Create the request object(s) $lineItem1 = new LineItem(); $lineItem1 ->setQuantity(1) ->setAmountExcludingTax(331) ->setDescription("Shoes") ->setId("Item #1") ->setAmountIncludingTax(400) ->setTaxAmount(69); $lineItem2 = new LineItem(); $lineItem2 ->setQuantity(2) ->setAmountExcludingTax(248) ->setDescription("Socks") ->setId("Item #2") ->setAmountIncludingTax(300) ->setTaxAmount(52); $amount = new Amount(); $amount ->setCurrency("GBP") ->setValue(1000); $shopperName = new ShopperName(); $shopperName ->setFirstName("Simon") ->setLastName("Hopper"); $deliveryAddress = new DeliveryAddress(); $deliveryAddress ->setCountry("GB") ->setStateOrProvince("Westminster") ->setCity("London") ->setHouseNumberOrName("8-10") ->setStreet("Broadway") ->setPostalCode("SW1H 0BG"); $billingAddress = new BillingAddress(); $billingAddress ->setCountry("GB") ->setStateOrProvince("Westminster") ->setCity("London") ->setHouseNumberOrName("8-10") ->setStreet("Broadway") ->setPostalCode("SW1H 0BG"); $createCheckoutSessionRequest = new CreateCheckoutSessionRequest(); $createCheckoutSessionRequest ->setReference("YOUR_ORDER_REFERENCE") ->setLineItems(array($lineItem1, $lineItem2)) ->setAmount($amount) ->setShopperName($shopperName) ->setTelephoneNumber("+44 203 936 4029") ->setMerchantAccount("ADYEN_MERCHANT_ACCOUNT") ->setDeliveryAddress($deliveryAddress) ->setCountryCode("GB") ->setShopperEmail("s.hopper@example.com") ->setBillingAddress($billingAddress) ->setReturnUrl("https://your-company.example.com/checkout?shopperOrder=12xy..") ->setShopperReference("YOUR_UNIQUE_SHOPPER_ID"); $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new PaymentsApi($client); $response = $service->sessions($createCheckoutSessionRequest, $requestOptions); ``` #### C\# ```cs // Adyen .NET API Library v34.0.0 to latest using System; using System.Collections.Generic; using Adyen.Checkout.Extensions; using Adyen.Checkout.Models; using Adyen.Checkout.Services; using Adyen.Core.Client; using Adyen.Core.Client.Extensions; using Adyen.Core.Options; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; var host = Host.CreateDefaultBuilder() .ConfigureCheckout( (context, services, config) => { config.ConfigureAdyenOptions(options => { options.AdyenApiKey = "ADYEN_API_KEY"; options.Environment = AdyenEnvironment.Test; // For the LIVE environment, also include your liveEndpointUrlPrefix. // options.LiveEndpointUrlPrefix = ""; }); services.AddAllCheckoutServices(); }) .Build(); var paymentsService = host.Services.GetRequiredService(); // Create the request object(s) var lineItem1 = new LineItem { Quantity = 1, AmountExcludingTax = 331, Description = "Shoes", Id = "Item #1", AmountIncludingTax = 400, TaxAmount = 69 }; var lineItem2 = new LineItem { Quantity = 2, AmountExcludingTax = 248, Description = "Socks", Id = "Item #2", AmountIncludingTax = 300, TaxAmount = 52 }; var amount = new Amount { Currency = "GBP", Value = 1000 }; var shopperName = new ShopperName { FirstName = "Simon", LastName = "Hopper" }; var deliveryAddress = new DeliveryAddress { Country = "GB", StateOrProvince = "Westminster", City = "London", HouseNumberOrName = "8-10", Street = "Broadway", PostalCode = "SW1H 0BG" }; var billingAddress = new BillingAddress { Country = "GB", StateOrProvince = "Westminster", City = "London", HouseNumberOrName = "8-10", Street = "Broadway", PostalCode = "SW1H 0BG" }; var createCheckoutSessionRequest = new CreateCheckoutSessionRequest { Reference = "YOUR_ORDER_REFERENCE", LineItems = new List{ lineItem1, lineItem2 }, Amount = amount, ShopperName = shopperName, TelephoneNumber = "+44 203 936 4029", MerchantAccount = "ADYEN_MERCHANT_ACCOUNT", DeliveryAddress = deliveryAddress, CountryCode = "GB", ShopperEmail = "s.hopper@example.com", BillingAddress = billingAddress, ReturnUrl = "https://your-company.example.com/checkout?shopperOrder=12xy..", ShopperReference = "YOUR_UNIQUE_SHOPPER_ID" }; string idempotencyKey = Guid.NewGuid().ToString(); // Send the request var result = await paymentsService.SessionsAsync(createCheckoutSessionRequest, new RequestOptions().AddIdempotencyKey(idempotencyKey)); if (result.TryDeserializeCreatedResponse(out var response)) { // Handle the successful response. } ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v30.0.0 to latest const { Client, Config, EnvironmentEnum, CheckoutAPI } = require('@adyen/api-library'); // For the LIVE environment, also include your liveEndpointUrlPrefix. const config = new Config({ apiKey: "ADYEN_API_KEY", environment: EnvironmentEnum.TEST }); const client = new Client(config); // Create the request object(s) const lineItem1 = { quantity: 1, amountExcludingTax: 331, description: "Shoes", id: "Item #1", amountIncludingTax: 400, taxAmount: 69 }; const lineItem2 = { quantity: 2, amountExcludingTax: 248, description: "Socks", id: "Item #2", amountIncludingTax: 300, taxAmount: 52 }; const amount = { currency: "GBP", value: 1000 }; const shopperName = { firstName: "Simon", lastName: "Hopper" }; const deliveryAddress = { country: "GB", stateOrProvince: "Westminster", city: "London", houseNumberOrName: "8-10", street: "Broadway", postalCode: "SW1H 0BG" }; const billingAddress = { country: "GB", stateOrProvince: "Westminster", city: "London", houseNumberOrName: "8-10", street: "Broadway", postalCode: "SW1H 0BG" }; const createCheckoutSessionRequest = { reference: "YOUR_ORDER_REFERENCE", lineItems: [lineItem1, lineItem2], amount: amount, shopperName: shopperName, telephoneNumber: "+44 203 936 4029", merchantAccount: "ADYEN_MERCHANT_ACCOUNT", deliveryAddress: deliveryAddress, countryCode: "GB", shopperEmail: "s.hopper@example.com", billingAddress: billingAddress, returnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy..", shopperReference: "YOUR_UNIQUE_SHOPPER_ID" }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = await checkoutAPI.PaymentsApi.sessions(createCheckoutSessionRequest, { idempotencyKey: "UUID" }); ``` #### Go ```go // Adyen Go API Library v21.0.0 to latest import ( "context" "github.com/adyen/adyen-go-api-library/v21/src/common" "github.com/adyen/adyen-go-api-library/v21/src/adyen" "github.com/adyen/adyen-go-api-library/v21/src/checkout" ) // For the LIVE environment, also include your liveEndpointUrlPrefix. client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Create the request object(s) lineItem1 := checkout.LineItem{ Quantity: common.PtrInt64(1), AmountExcludingTax: common.PtrInt64(331), Description: common.PtrString("Shoes"), Id: common.PtrString("Item #1"), AmountIncludingTax: common.PtrInt64(400), TaxAmount: common.PtrInt64(69), } lineItem2 := checkout.LineItem{ Quantity: common.PtrInt64(2), AmountExcludingTax: common.PtrInt64(248), Description: common.PtrString("Socks"), Id: common.PtrString("Item #2"), AmountIncludingTax: common.PtrInt64(300), TaxAmount: common.PtrInt64(52), } amount := checkout.Amount{ Currency: "GBP", Value: 1000, } shopperName := checkout.ShopperName{ FirstName: "Simon", LastName: "Hopper", } deliveryAddress := checkout.DeliveryAddress{ Country: "GB", StateOrProvince: common.PtrString("Westminster"), City: "London", HouseNumberOrName: "8-10", Street: "Broadway", PostalCode: "SW1H 0BG", } billingAddress := checkout.BillingAddress{ Country: "GB", StateOrProvince: common.PtrString("Westminster"), City: "London", HouseNumberOrName: "8-10", Street: "Broadway", PostalCode: "SW1H 0BG", } createCheckoutSessionRequest := checkout.CreateCheckoutSessionRequest{ Reference: "YOUR_ORDER_REFERENCE", LineItems: []checkout.LineItem{ lineItem1, lineItem2, }, Amount: amount, ShopperName: &shopperName, TelephoneNumber: common.PtrString("+44 203 936 4029"), MerchantAccount: "ADYEN_MERCHANT_ACCOUNT", DeliveryAddress: &deliveryAddress, CountryCode: common.PtrString("GB"), ShopperEmail: common.PtrString("s.hopper@example.com"), BillingAddress: &billingAddress, ReturnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy..", ShopperReference: common.PtrString("YOUR_UNIQUE_SHOPPER_ID"), } // Send the request service := client.Checkout() req := service.PaymentsApi.SessionsInput().IdempotencyKey("UUID").CreateCheckoutSessionRequest(createCheckoutSessionRequest) res, httpRes, err := service.PaymentsApi.Sessions(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v14.0.0 to latest import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" # For the LIVE environment, also include your liveEndpointUrlPrefix. adyen.client.platform = "test" # The environment to use library in. # Create the request object(s) json_request = { "amount": { "value": 1000, "currency": "GBP" }, "shopperName": { "firstName": "Simon", "lastName": "Hopper" }, "shopperEmail": "s.hopper@example.com", "shopperReference": "YOUR_UNIQUE_SHOPPER_ID", "reference": "YOUR_ORDER_REFERENCE", "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "returnUrl": "https://your-company.example.com/checkout?shopperOrder=12xy..", "countryCode": "GB", "telephoneNumber": "+44 203 936 4029", "billingAddress": { "city": "London", "country": "GB", "houseNumberOrName": "8-10", "postalCode": "SW1H 0BG", "stateOrProvince": "Westminster", "street": "Broadway" }, "deliveryAddress": { "city": "London", "country": "GB", "houseNumberOrName": "8-10", "postalCode": "SW1H 0BG", "stateOrProvince": "Westminster", "street": "Broadway" }, "lineItems": [{ "description": "Shoes", "quantity": "1", "amountIncludingTax": "400", "amountExcludingTax": "331", "taxAmount": "69", "id": "Item #1" }, { "description": "Socks", "quantity": "2", "amountIncludingTax": "300", "amountExcludingTax": "248", "taxAmount": "52", "id": "Item #2" }] } # Send the request result = adyen.checkout.payments_api.sessions(request=json_request, idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v11.0.0 to latest require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' # For the LIVE environment, also include your liveEndpointUrlPrefix. adyen.env = :test # Set to "live" for live environment # Create the request object(s) request_body = { "amount" => { "value" => 1000, "currency" => "GBP" }, "shopperName" => { "firstName" => "Simon", "lastName" => "Hopper" }, "shopperEmail" => "s.hopper@example.com", "shopperReference" => "YOUR_UNIQUE_SHOPPER_ID", "reference" => "YOUR_ORDER_REFERENCE", "merchantAccount" => "ADYEN_MERCHANT_ACCOUNT", "returnUrl" => "https://your-company.example.com/checkout?shopperOrder=12xy..", "countryCode" => "GB", "telephoneNumber" => "+44 203 936 4029", "billingAddress" => { "city" => "London", "country" => "GB", "houseNumberOrName" => "8-10", "postalCode" => "SW1H 0BG", "stateOrProvince" => "Westminster", "street" => "Broadway" }, "deliveryAddress" => { "city" => "London", "country" => "GB", "houseNumberOrName" => "8-10", "postalCode" => "SW1H 0BG", "stateOrProvince" => "Westminster", "street" => "Broadway" }, "lineItems" => [{ "description" => "Shoes", "quantity" => "1", "amountIncludingTax" => "400", "amountExcludingTax" => "331", "taxAmount" => "69", "id" => "Item #1" }, { "description" => "Socks", "quantity" => "2", "amountIncludingTax" => "300", "amountExcludingTax" => "248", "taxAmount" => "52", "id" => "Item #2" }] } # Send the request result = adyen.checkout.payments_api.sessions(request_body, headers: { 'Idempotency-Key' => 'UUID' }) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v30.0.0 to latest import { Client, Config, EnvironmentEnum, CheckoutAPI, Types } from "@adyen/api-library"; // For the LIVE environment, also include your liveEndpointUrlPrefix. const config = new Config({ apiKey: "ADYEN_API_KEY", environment: EnvironmentEnum.TEST }); const client = new Client(config); // Create the request object(s) const lineItem1: Types.checkout.LineItem = { quantity: 1, amountExcludingTax: 331, description: "Shoes", id: "Item #1", amountIncludingTax: 400, taxAmount: 69 }; const lineItem2: Types.checkout.LineItem = { quantity: 2, amountExcludingTax: 248, description: "Socks", id: "Item #2", amountIncludingTax: 300, taxAmount: 52 }; const amount: Types.checkout.Amount = { currency: "GBP", value: 1000 }; const shopperName: Types.checkout.ShopperName = { firstName: "Simon", lastName: "Hopper" }; const deliveryAddress: Types.checkout.DeliveryAddress = { country: "GB", stateOrProvince: "Westminster", city: "London", houseNumberOrName: "8-10", street: "Broadway", postalCode: "SW1H 0BG" }; const billingAddress: Types.checkout.BillingAddress = { country: "GB", stateOrProvince: "Westminster", city: "London", houseNumberOrName: "8-10", street: "Broadway", postalCode: "SW1H 0BG" }; const createCheckoutSessionRequest: Types.checkout.CreateCheckoutSessionRequest = { reference: "YOUR_ORDER_REFERENCE", lineItems: [lineItem1, lineItem2], amount: amount, shopperName: shopperName, telephoneNumber: "+44 203 936 4029", merchantAccount: "ADYEN_MERCHANT_ACCOUNT", deliveryAddress: deliveryAddress, countryCode: "GB", shopperEmail: "s.hopper@example.com", billingAddress: billingAddress, returnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy..", shopperReference: "YOUR_UNIQUE_SHOPPER_ID" }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = await checkoutAPI.PaymentsApi.sessions(createCheckoutSessionRequest, { idempotencyKey: "UUID" }); ``` ### Drop-In-Import-Optional ## Import Clearpay (optional) When you [import Adyen Web](https://docs.adyen.com/online-payments/build-your-integration/sessions-flow?platform=Web\&integration=Drop-in#get-adyen-web), you can optionally import individual payment methods to optimize performance by using [tree shaking](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking). To do this, include `Redirect`. **Import** ```javascript import { AdyenCheckout, Dropin, Redirect } from '@adyen/adyen-web'; ``` ### Drop-In-Capture ## Capture the payment Depending on your merchant account configuration, Clearpay payments are captured automatically after authorisation, or manually captured. If you prefer to capture the payment after the goods have been sent, you need to set up a [capture delay](https://docs.adyen.com/online-payments/capture#delayed-automatic-capture) or use [manual capture](https://docs.adyen.com/online-payments/capture#capture-a-payment). To partially capture a payment, you also need to use manual capture. Clearpay payments have to be captured within 13 days after authorisation. During authorisation, the shopper is charged for the first installment. If the payment is not captured within 13 days, before the second installment, Clearpay cancels the payment and refunds the first installment to the shopper. For testing purposes, Clearpay authorisations expire in one day. When you use manual capture, you need to capture test Clearpay payments within one day after authorisation. ### Full or partial manual captures When you use manual capture, in your [/payments/{paymentPspReference}/captures](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/captures) request specify: * [amount.value](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/captures#request-amount-value): the full or partial amount that the shopper should pay. * [lineItems](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/captures#request-lineItems): (optional) price and product information for the items that the shopper should pay for. Any unclaimed amount that is left over after partially capturing a payment is automatically cancelled. When your account is enabled for *multiple* partial captures, the unclaimed amount after an initial capture is not automatically cancelled. To set up multiple partial captures, contact our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other). Multiple partial captures will create a new invoice for each capture. ### Drop-In-Refunds-And-Cancellations ## Refunds and cancellations If a payment has not yet been captured, you can [cancel](https://docs.adyen.com/online-payments/cancel) it. If a payment has already been captured and you want to return the funds to the shopper, you need to [refund](https://docs.adyen.com/online-payments/refund) the payment. ### Full or partial refunds To fully or partially refund a payment, in your [/payments/{paymentPspReference}/refunds](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/refunds) request specify: * [amount.value](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/refunds#request-amount-value): the full or partial amount to be refunded to the shopper. * [lineItems](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/refunds#request-lineItems): (optional) price and product information about the refunded items. ### Drop-In-Discounts ## Discounts To offer discounts, your payment request must include the negative amount to be added to the original price. The following example shows how to specify a discount of 1 GBP on Item #2: ```json { "amount":{ "value":800, "currency":"GBP" }, ... "lineItems":[ { "description":"Test Clearpay 1", "quantity":"1", "amountIncludingTax":"400", "id":"Item #1" }, { "description":"Test Clearpay 2", "quantity":"2", "amountIncludingTax":"300", "id":"Item #2" } { "description":"Discount", "quantity":"2", "amountIncludingTax":"-100", "id":"Item #2 Discount" } ] } ``` ### Drop-In-Test-And-Go-Live ## Test and go live To test Clearpay payments, you need to use the Clearpay sandbox environment and create a test Clearpay shopper account. Clearpay offers separate sandbox environments and test details based on country and region.\ Follow the links to the Clearpay developer documentation for more details. | Clearpay developer documentation | Description | | -------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | | [Test Environment (Sandbox)](https://developers.clearpay.co.uk/v-2/messaging-implementation#sandbox-testing) | More information about how to get access to the sandbox environment. | | [Customer Accounts](https://developers.clearpay.co.uk/merchant-portal) | Learn how to create a test Clearpay shopper account. | | [Test cards](https://developers.clearpay.co.uk/v-2/guides/api-development/test-environments#test-credit-cards) | List of available Clearpay test cards to test different payment flows. | In the Clearpay sandbox environment, you will see Adyen as the merchant name. When you go live, this will change to your own merchant name. When you have set up your sandbox environment, and created your Clearpay test shopper account, you can make a test payment. You can check the status of test payments in your [Customer Area](https://ca-test.adyen.com/) > **Payments** > **Payment list**. Before you can accept live Clearpay payments, you need to [submit a request for Clearpay](https://docs.adyen.com/payment-methods/add-payment-methods) in your [live Customer Area](https://ca-live.adyen.com/). ## Advanced flow Drop-in ### Drop-In-Before-You-Begin ## Requirements | Requirement | Description | | | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - | | **Integration type** | Make sure that you have an existing Advanced flow [Web Drop-in integration](https://docs.adyen.com/online-payments/build-your-integration/advanced-flow?platform=%7B%7BgetParameter%28%27platform%27%29%7D%7D\&integration=Drop-in). | | | **Redirect handling** | Make sure that your existing integration is set up to [handle the redirect](https://docs.adyen.com/online-payments/build-your-integration/advanced-flow/?platform=Web\&integration=Drop-in#handle-the-redirect). `action.type`: **redirect** | | | **Setup steps** | Before you begin, [add Clearpay in your Customer Area](https://docs.adyen.com/payment-methods/add-payment-methods). | | ### Drop-In-Import-Optional ## Import Clearpay (optional) When you [import Adyen Web](https://docs.adyen.com/online-payments/build-your-integration/advanced-flow/?platform=Web\&integration=Drop-in#get-adyen-web), you can optionally import individual payment methods to optimize performance by using [tree shaking](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking). To do this, include `Redirect`. **Import** ```javascript import { AdyenCheckout, Dropin, Redirect } from '@adyen/adyen-web'; ``` ### Drop-In-Add-Parameters-Payments-Request ## Add additional parameters to your /payments request When you [make a payment](https://docs.adyen.com/online-payments/build-your-integration/advanced-flow/?platform=Web\&integration=Drop-in#make-a-payment), add the following parameters: | Parameter | Required | Description | | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | | [shopperName](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperName) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The shopper's full name. | | [shopperEmail](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperEmail) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The shopper's email address. | | [shopperReference](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperReference) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | A unique reference to identify the shopper. Minimum length: three characters. | | [countryCode](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-countryCode) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The shopper's country/region. | | [billingAddress](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-billingAddress) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The postal address to be included on the invoice. | | [deliveryAddress](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-deliveryAddress) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The postal address where the goods will be shipped. | | [lineItems](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Price and product information about the purchased items. | | [telephoneNumber](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-telephoneNumber) | | The shopper's telephone number, if provided. | **Example payment request for Clearpay** #### curl ```bash curl https://checkout-test.adyen.com/v72/payments \ -H 'x-API-key: ADYEN_API_KEY' \ -H 'idempotency-key: YOUR_IDEMPOTENCY_KEY' \ -H 'content-type: application/json' \ -X POST -d '{ "paymentMethod":{ "type":"clearpay" }, "amount":{ "value":1000, "currency":"GBP" }, "shopperName":{ "firstName":"Simon", "lastName":"Hopper" }, "shopperEmail":"s.hopper@example.com", "shopperReference":"YOUR_UNIQUE_SHOPPER_ID", "reference":"YOUR_ORDER_REFERENCE", "merchantAccount":"ADYEN_MERCHANT_ACCOUNT", "returnUrl":"https://your-company.example.com/checkout?shopperOrder=12xy..", "countryCode":"GB", "telephoneNumber":"+44 203 936 4029", "billingAddress":{ "city":"London", "country":"GB", "houseNumberOrName":"8-10", "postalCode":"SW1H 0BG", "stateOrProvince":"Westminster", "street":"Broadway" }, "deliveryAddress":{ "city":"London", "country":"GB", "houseNumberOrName":"8-10", "postalCode":"SW1H 0BG", "stateOrProvince":"Westminster", "street":"Broadway" }, "lineItems":[ { "description":"Shoes", "quantity":"1", "amountIncludingTax":"400", "amountExcludingTax": "331", "taxAmount": "69", "id":"Item #1" }, { "description":"Socks", "quantity":"2", "amountIncludingTax":"300", "amountExcludingTax": "248", "taxAmount": "52", "id":"Item #2" } ] }' ``` #### Java ```java // Adyen Java API Library v38.0.0 to latest import com.adyen.Client; import com.adyen.Config; import com.adyen.enums.Environment; import com.adyen.model.*; import com.adyen.service.*; import java.math.*; import com.adyen.model.checkout.*; import java.time.OffsetDateTime; import java.util.*; import com.adyen.model.RequestOptions; import com.adyen.service.checkout.*; Config config = new Config() .apiKey("ADYEN_API_KEY") .environment(Environment.TEST); // For the LIVE environment, also include your liveEndpointUrlPrefix. Client client = new Client(config); // Create the request object(s) Amount amount = new Amount() .currency("GBP") .value(1000L); LineItem lineItem1 = new LineItem() .quantity(1L) .amountExcludingTax(331L) .description("Shoes") .id("Item #1") .amountIncludingTax(400L) .taxAmount(69L); LineItem lineItem2 = new LineItem() .quantity(2L) .amountExcludingTax(248L) .description("Socks") .id("Item #2") .amountIncludingTax(300L) .taxAmount(52L); ShopperName shopperName = new ShopperName() .firstName("Simon") .lastName("Hopper"); DeliveryAddress deliveryAddress = new DeliveryAddress() .country("GB") .stateOrProvince("Westminster") .city("London") .houseNumberOrName("8-10") .street("Broadway") .postalCode("SW1H 0BG"); AfterpayDetails afterpayDetails = new AfterpayDetails() .type(AfterpayDetails.TypeEnum.CLEARPAY); BillingAddress billingAddress = new BillingAddress() .country("GB") .stateOrProvince("Westminster") .city("London") .houseNumberOrName("8-10") .street("Broadway") .postalCode("SW1H 0BG"); PaymentRequest paymentRequest = new PaymentRequest() .amount(amount) .telephoneNumber("+44 203 936 4029") .shopperEmail("s.hopper@example.com") .reference("YOUR_ORDER_REFERENCE") .lineItems(Arrays.asList(lineItem1, lineItem2)) .shopperName(shopperName) .merchantAccount("ADYEN_MERCHANT_ACCOUNT") .deliveryAddress(deliveryAddress) .countryCode("GB") .paymentMethod(new CheckoutPaymentMethod(afterpayDetails)) .billingAddress(billingAddress) .returnUrl("https://your-company.example.com/checkout?shopperOrder=12xy..") .shopperReference("YOUR_UNIQUE_SHOPPER_ID"); // Send the request PaymentsApi service = new PaymentsApi(client); PaymentResponse response = service.payments(paymentRequest, new RequestOptions().idempotencyKey("UUID")); ``` #### PHP ```php setXApiKey("ADYEN_API_KEY"); // For the LIVE environment, also include your liveEndpointUrlPrefix. $client->setEnvironment(Environment::TEST); // Create the request object(s) $amount = new Amount(); $amount ->setCurrency("GBP") ->setValue(1000); $lineItem1 = new LineItem(); $lineItem1 ->setQuantity(1) ->setAmountExcludingTax(331) ->setDescription("Shoes") ->setId("Item #1") ->setAmountIncludingTax(400) ->setTaxAmount(69); $lineItem2 = new LineItem(); $lineItem2 ->setQuantity(2) ->setAmountExcludingTax(248) ->setDescription("Socks") ->setId("Item #2") ->setAmountIncludingTax(300) ->setTaxAmount(52); $shopperName = new ShopperName(); $shopperName ->setFirstName("Simon") ->setLastName("Hopper"); $deliveryAddress = new DeliveryAddress(); $deliveryAddress ->setCountry("GB") ->setStateOrProvince("Westminster") ->setCity("London") ->setHouseNumberOrName("8-10") ->setStreet("Broadway") ->setPostalCode("SW1H 0BG"); $checkoutPaymentMethod = new CheckoutPaymentMethod(); $checkoutPaymentMethod ->setType("clearpay"); $billingAddress = new BillingAddress(); $billingAddress ->setCountry("GB") ->setStateOrProvince("Westminster") ->setCity("London") ->setHouseNumberOrName("8-10") ->setStreet("Broadway") ->setPostalCode("SW1H 0BG"); $paymentRequest = new PaymentRequest(); $paymentRequest ->setAmount($amount) ->setTelephoneNumber("+44 203 936 4029") ->setShopperEmail("s.hopper@example.com") ->setReference("YOUR_ORDER_REFERENCE") ->setLineItems(array($lineItem1, $lineItem2)) ->setShopperName($shopperName) ->setMerchantAccount("ADYEN_MERCHANT_ACCOUNT") ->setDeliveryAddress($deliveryAddress) ->setCountryCode("GB") ->setPaymentMethod($checkoutPaymentMethod) ->setBillingAddress($billingAddress) ->setReturnUrl("https://your-company.example.com/checkout?shopperOrder=12xy..") ->setShopperReference("YOUR_UNIQUE_SHOPPER_ID"); $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new PaymentsApi($client); $response = $service->payments($paymentRequest, $requestOptions); ``` #### C\# ```cs // Adyen .NET API Library v34.0.0 to latest using System; using System.Collections.Generic; using Adyen.Checkout.Extensions; using Adyen.Checkout.Models; using Adyen.Checkout.Services; using Adyen.Core.Client; using Adyen.Core.Client.Extensions; using Adyen.Core.Options; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; var host = Host.CreateDefaultBuilder() .ConfigureCheckout( (context, services, config) => { config.ConfigureAdyenOptions(options => { options.AdyenApiKey = "ADYEN_API_KEY"; options.Environment = AdyenEnvironment.Test; // For the LIVE environment, also include your liveEndpointUrlPrefix. // options.LiveEndpointUrlPrefix = ""; }); services.AddAllCheckoutServices(); }) .Build(); var paymentsService = host.Services.GetRequiredService(); // Create the request object(s) var amount = new Amount { Currency = "GBP", Value = 1000 }; var lineItem1 = new LineItem { Quantity = 1, AmountExcludingTax = 331, Description = "Shoes", Id = "Item #1", AmountIncludingTax = 400, TaxAmount = 69 }; var lineItem2 = new LineItem { Quantity = 2, AmountExcludingTax = 248, Description = "Socks", Id = "Item #2", AmountIncludingTax = 300, TaxAmount = 52 }; var shopperName = new ShopperName { FirstName = "Simon", LastName = "Hopper" }; var deliveryAddress = new DeliveryAddress { Country = "GB", StateOrProvince = "Westminster", City = "London", HouseNumberOrName = "8-10", Street = "Broadway", PostalCode = "SW1H 0BG" }; var afterpayDetails = new AfterpayDetails { Type = AfterpayDetails.TypeEnum.Clearpay }; var billingAddress = new BillingAddress { Country = "GB", StateOrProvince = "Westminster", City = "London", HouseNumberOrName = "8-10", Street = "Broadway", PostalCode = "SW1H 0BG" }; var paymentRequest = new PaymentRequest { Amount = amount, TelephoneNumber = "+44 203 936 4029", ShopperEmail = "s.hopper@example.com", Reference = "YOUR_ORDER_REFERENCE", LineItems = new List{ lineItem1, lineItem2 }, ShopperName = shopperName, MerchantAccount = "ADYEN_MERCHANT_ACCOUNT", DeliveryAddress = deliveryAddress, CountryCode = "GB", PaymentMethod = new CheckoutPaymentMethod(afterpayDetails), BillingAddress = billingAddress, ReturnUrl = "https://your-company.example.com/checkout?shopperOrder=12xy..", ShopperReference = "YOUR_UNIQUE_SHOPPER_ID" }; string idempotencyKey = Guid.NewGuid().ToString(); // Send the request var result = await paymentsService.PaymentsAsync(paymentRequest, new RequestOptions().AddIdempotencyKey(idempotencyKey)); if (result.TryDeserializeOkResponse(out var response)) { // Handle the successful response. } ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v30.0.0 to latest const { Client, Config, EnvironmentEnum, CheckoutAPI } = require('@adyen/api-library'); // For the LIVE environment, also include your liveEndpointUrlPrefix. const config = new Config({ apiKey: "ADYEN_API_KEY", environment: EnvironmentEnum.TEST }); const client = new Client(config); // Create the request object(s) const amount = { currency: "GBP", value: 1000 }; const lineItem1 = { quantity: 1, amountExcludingTax: 331, description: "Shoes", id: "Item #1", amountIncludingTax: 400, taxAmount: 69 }; const lineItem2 = { quantity: 2, amountExcludingTax: 248, description: "Socks", id: "Item #2", amountIncludingTax: 300, taxAmount: 52 }; const shopperName = { firstName: "Simon", lastName: "Hopper" }; const deliveryAddress = { country: "GB", stateOrProvince: "Westminster", city: "London", houseNumberOrName: "8-10", street: "Broadway", postalCode: "SW1H 0BG" }; const afterpayDetails = { type: "clearpay" }; const billingAddress = { country: "GB", stateOrProvince: "Westminster", city: "London", houseNumberOrName: "8-10", street: "Broadway", postalCode: "SW1H 0BG" }; const paymentRequest = { amount: amount, telephoneNumber: "+44 203 936 4029", shopperEmail: "s.hopper@example.com", reference: "YOUR_ORDER_REFERENCE", lineItems: [lineItem1, lineItem2], shopperName: shopperName, merchantAccount: "ADYEN_MERCHANT_ACCOUNT", deliveryAddress: deliveryAddress, countryCode: "GB", paymentMethod: afterpayDetails, billingAddress: billingAddress, returnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy..", shopperReference: "YOUR_UNIQUE_SHOPPER_ID" }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = await checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` #### Go ```go // Adyen Go API Library v21.0.0 to latest import ( "context" "github.com/adyen/adyen-go-api-library/v21/src/common" "github.com/adyen/adyen-go-api-library/v21/src/adyen" "github.com/adyen/adyen-go-api-library/v21/src/checkout" ) // For the LIVE environment, also include your liveEndpointUrlPrefix. client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Create the request object(s) amount := checkout.Amount{ Currency: "GBP", Value: 1000, } lineItem1 := checkout.LineItem{ Quantity: common.PtrInt64(1), AmountExcludingTax: common.PtrInt64(331), Description: common.PtrString("Shoes"), Id: common.PtrString("Item #1"), AmountIncludingTax: common.PtrInt64(400), TaxAmount: common.PtrInt64(69), } lineItem2 := checkout.LineItem{ Quantity: common.PtrInt64(2), AmountExcludingTax: common.PtrInt64(248), Description: common.PtrString("Socks"), Id: common.PtrString("Item #2"), AmountIncludingTax: common.PtrInt64(300), TaxAmount: common.PtrInt64(52), } shopperName := checkout.ShopperName{ FirstName: "Simon", LastName: "Hopper", } deliveryAddress := checkout.DeliveryAddress{ Country: "GB", StateOrProvince: common.PtrString("Westminster"), City: "London", HouseNumberOrName: "8-10", Street: "Broadway", PostalCode: "SW1H 0BG", } afterpayDetails := checkout.AfterpayDetails{ Type: "clearpay", } billingAddress := checkout.BillingAddress{ Country: "GB", StateOrProvince: common.PtrString("Westminster"), City: "London", HouseNumberOrName: "8-10", Street: "Broadway", PostalCode: "SW1H 0BG", } paymentRequest := checkout.PaymentRequest{ Amount: amount, TelephoneNumber: common.PtrString("+44 203 936 4029"), ShopperEmail: common.PtrString("s.hopper@example.com"), Reference: "YOUR_ORDER_REFERENCE", LineItems: []checkout.LineItem{ lineItem1, lineItem2, }, ShopperName: &shopperName, MerchantAccount: "ADYEN_MERCHANT_ACCOUNT", DeliveryAddress: &deliveryAddress, CountryCode: common.PtrString("GB"), PaymentMethod: checkout.AfterpayDetailsAsCheckoutPaymentMethod(&afterpayDetails), BillingAddress: &billingAddress, ReturnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy..", ShopperReference: common.PtrString("YOUR_UNIQUE_SHOPPER_ID"), } // Send the request service := client.Checkout() req := service.PaymentsApi.PaymentsInput().IdempotencyKey("UUID").PaymentRequest(paymentRequest) res, httpRes, err := service.PaymentsApi.Payments(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v14.0.0 to latest import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" # For the LIVE environment, also include your liveEndpointUrlPrefix. adyen.client.platform = "test" # The environment to use library in. # Create the request object(s) json_request = { "paymentMethod": { "type": "clearpay" }, "amount": { "value": 1000, "currency": "GBP" }, "shopperName": { "firstName": "Simon", "lastName": "Hopper" }, "shopperEmail": "s.hopper@example.com", "shopperReference": "YOUR_UNIQUE_SHOPPER_ID", "reference": "YOUR_ORDER_REFERENCE", "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "returnUrl": "https://your-company.example.com/checkout?shopperOrder=12xy..", "countryCode": "GB", "telephoneNumber": "+44 203 936 4029", "billingAddress": { "city": "London", "country": "GB", "houseNumberOrName": "8-10", "postalCode": "SW1H 0BG", "stateOrProvince": "Westminster", "street": "Broadway" }, "deliveryAddress": { "city": "London", "country": "GB", "houseNumberOrName": "8-10", "postalCode": "SW1H 0BG", "stateOrProvince": "Westminster", "street": "Broadway" }, "lineItems": [{ "description": "Shoes", "quantity": "1", "amountIncludingTax": "400", "amountExcludingTax": "331", "taxAmount": "69", "id": "Item #1" }, { "description": "Socks", "quantity": "2", "amountIncludingTax": "300", "amountExcludingTax": "248", "taxAmount": "52", "id": "Item #2" }] } # Send the request result = adyen.checkout.payments_api.payments(request=json_request, idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v11.0.0 to latest require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' # For the LIVE environment, also include your liveEndpointUrlPrefix. adyen.env = :test # Set to "live" for live environment # Create the request object(s) request_body = { "paymentMethod" => { "type" => "clearpay" }, "amount" => { "value" => 1000, "currency" => "GBP" }, "shopperName" => { "firstName" => "Simon", "lastName" => "Hopper" }, "shopperEmail" => "s.hopper@example.com", "shopperReference" => "YOUR_UNIQUE_SHOPPER_ID", "reference" => "YOUR_ORDER_REFERENCE", "merchantAccount" => "ADYEN_MERCHANT_ACCOUNT", "returnUrl" => "https://your-company.example.com/checkout?shopperOrder=12xy..", "countryCode" => "GB", "telephoneNumber" => "+44 203 936 4029", "billingAddress" => { "city" => "London", "country" => "GB", "houseNumberOrName" => "8-10", "postalCode" => "SW1H 0BG", "stateOrProvince" => "Westminster", "street" => "Broadway" }, "deliveryAddress" => { "city" => "London", "country" => "GB", "houseNumberOrName" => "8-10", "postalCode" => "SW1H 0BG", "stateOrProvince" => "Westminster", "street" => "Broadway" }, "lineItems" => [{ "description" => "Shoes", "quantity" => "1", "amountIncludingTax" => "400", "amountExcludingTax" => "331", "taxAmount" => "69", "id" => "Item #1" }, { "description" => "Socks", "quantity" => "2", "amountIncludingTax" => "300", "amountExcludingTax" => "248", "taxAmount" => "52", "id" => "Item #2" }] } # Send the request result = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' => 'UUID' }) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v30.0.0 to latest import { Client, Config, EnvironmentEnum, CheckoutAPI, Types } from "@adyen/api-library"; // For the LIVE environment, also include your liveEndpointUrlPrefix. const config = new Config({ apiKey: "ADYEN_API_KEY", environment: EnvironmentEnum.TEST }); const client = new Client(config); // Create the request object(s) const amount: Types.checkout.Amount = { currency: "GBP", value: 1000 }; const lineItem1: Types.checkout.LineItem = { quantity: 1, amountExcludingTax: 331, description: "Shoes", id: "Item #1", amountIncludingTax: 400, taxAmount: 69 }; const lineItem2: Types.checkout.LineItem = { quantity: 2, amountExcludingTax: 248, description: "Socks", id: "Item #2", amountIncludingTax: 300, taxAmount: 52 }; const shopperName: Types.checkout.ShopperName = { firstName: "Simon", lastName: "Hopper" }; const deliveryAddress: Types.checkout.DeliveryAddress = { country: "GB", stateOrProvince: "Westminster", city: "London", houseNumberOrName: "8-10", street: "Broadway", postalCode: "SW1H 0BG" }; const afterpayDetails: Types.checkout.AfterpayDetails = { type: Types.checkout.AfterpayDetails.TypeEnum.Clearpay }; const billingAddress: Types.checkout.BillingAddress = { country: "GB", stateOrProvince: "Westminster", city: "London", houseNumberOrName: "8-10", street: "Broadway", postalCode: "SW1H 0BG" }; const paymentRequest: Types.checkout.PaymentRequest = { amount: amount, telephoneNumber: "+44 203 936 4029", shopperEmail: "s.hopper@example.com", reference: "YOUR_ORDER_REFERENCE", lineItems: [lineItem1, lineItem2], shopperName: shopperName, merchantAccount: "ADYEN_MERCHANT_ACCOUNT", deliveryAddress: deliveryAddress, countryCode: "GB", paymentMethod: afterpayDetails, billingAddress: billingAddress, returnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy..", shopperReference: "YOUR_UNIQUE_SHOPPER_ID" }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = await checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` The response includes `action.type`: **redirect**. **Example response with a redirect action** ```json { "resultCode":"RedirectShopper", "action":{ "paymentMethodType":"clearpay", "method":"GET", "url":"https://checkoutshopper-test.adyen.com/checkoutshopper/checkoutPaymentRedirect?redirectData=...", "type":"redirect" } } ``` ### Drop-In-Capture ## Capture the payment Depending on your merchant account configuration, Clearpay payments are captured automatically after authorisation, or manually captured. If you prefer to capture the payment after the goods have been sent, you need to set up a [capture delay](https://docs.adyen.com/online-payments/capture#delayed-automatic-capture) or use [manual capture](https://docs.adyen.com/online-payments/capture#capture-a-payment). To partially capture a payment, you also need to use manual capture. Clearpay payments have to be captured within 13 days after authorisation. During authorisation, the shopper is charged for the first installment. If the payment is not captured within 13 days, before the second installment, Clearpay cancels the payment and refunds the first installment to the shopper. For testing purposes, Clearpay authorisations expire in one day. When you use manual capture, you need to capture test Clearpay payments within one day after authorisation. ### Full or partial manual captures When you use manual capture, in your [/payments/{paymentPspReference}/captures](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/captures) request specify: * [amount.value](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/captures#request-amount-value): the full or partial amount that the shopper should pay. * [lineItems](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/captures#request-lineItems): (optional) price and product information for the items that the shopper should pay for. Any unclaimed amount that is left over after partially capturing a payment is automatically cancelled. When your account is enabled for *multiple* partial captures, the unclaimed amount after an initial capture is not automatically cancelled. To set up multiple partial captures, contact our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other). Multiple partial captures will create a new invoice for each capture. ### Drop-In-Refunds-And-Cancellations ## Refunds and cancellations If a payment has not yet been captured, you can [cancel](https://docs.adyen.com/online-payments/cancel) it. If a payment has already been captured and you want to return the funds to the shopper, you need to [refund](https://docs.adyen.com/online-payments/refund) the payment. ### Full or partial refunds To fully or partially refund a payment, in your [/payments/{paymentPspReference}/refunds](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/refunds) request specify: * [amount.value](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/refunds#request-amount-value): the full or partial amount to be refunded to the shopper. * [lineItems](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/refunds#request-lineItems): (optional) price and product information about the refunded items. ### Drop-In-Discounts ## Discounts To offer discounts, your payment request must include the negative amount to be added to the original price. The following example shows how to specify a discount of 1 GBP on Item #2: ```json { "amount":{ "value":800, "currency":"GBP" }, ... "lineItems":[ { "description":"Test Clearpay 1", "quantity":"1", "amountIncludingTax":"400", "id":"Item #1" }, { "description":"Test Clearpay 2", "quantity":"2", "amountIncludingTax":"300", "id":"Item #2" } { "description":"Discount", "quantity":"2", "amountIncludingTax":"-100", "id":"Item #2 Discount" } ] } ``` ### Drop-In-Test-And-Go-Live ## Test and go live To test Clearpay payments, you need to use the Clearpay sandbox environment and create a test Clearpay shopper account. Clearpay offers separate sandbox environments and test details based on country and region.\ Follow the links to the Clearpay developer documentation for more details. | Clearpay developer documentation | Description | | -------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | | [Test Environment (Sandbox)](https://developers.clearpay.co.uk/v-2/messaging-implementation#sandbox-testing) | More information about how to get access to the sandbox environment. | | [Customer Accounts](https://developers.clearpay.co.uk/merchant-portal) | Learn how to create a test Clearpay shopper account. | | [Test cards](https://developers.clearpay.co.uk/v-2/guides/api-development/test-environments#test-credit-cards) | List of available Clearpay test cards to test different payment flows. | In the Clearpay sandbox environment, you will see Adyen as the merchant name. When you go live, this will change to your own merchant name. When you have set up your sandbox environment, and created your Clearpay test shopper account, you can make a test payment. You can check the status of test payments in your [Customer Area](https://ca-test.adyen.com/) > **Payments** > **Payment list**. Before you can accept live Clearpay payments, you need to [submit a request for Clearpay](https://docs.adyen.com/payment-methods/add-payment-methods) in your [live Customer Area](https://ca-live.adyen.com/).