--- title: "Alipay for API only" description: "Add Alipay to your API-only integration." url: "https://docs.adyen.com/payment-methods/alipay/api-only" source_url: "https://docs.adyen.com/payment-methods/alipay/api-only.md" canonical: "https://docs.adyen.com/payment-methods/alipay/api-only" last_modified: "2026-10-09T12:57:18+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. # Alipay for API only Add Alipay to your API-only integration. You can add Alipay to your existing integration. The following instructions show only what you must add to your integration specifically for Alipay. 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. ## Requirements | Requirement | Description | | | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - | | **Integration type** | Make sure that you have an existing [API-only integration](https://docs.adyen.com/online-payments/build-your-integration/advanced-flow/?platform=Web\&integration=API%20only). | | | **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=API%20only#handle-the-redirect). `action.type`: **redirect**. | | | **Setup steps** | Before you begin, [add Alipay in your Customer Area](https://docs.adyen.com/payment-methods/add-payment-methods). | | ## How it works 1. The shopper selects Alipay as the payment method. 2. The shopper enters their details in the [payment form that you build](https://docs.adyen.com/payment-methods/alipay/api-only#build-your-payment-form). 3. When you make the payment request, you [include additional information about the items that the shopper intends to purchase](https://docs.adyen.com/payment-methods/alipay/api-only#additional-parameters-payments). 4. Your existing integration setup will [handle the redirect](https://docs.adyen.com/online-payments/build-your-integration/advanced-flow/?platform=Web\&integration=API%20only#handle-the-redirect). ## Build your payment form Include Alipay in the list of available payment methods. You do not need to collect any information from the shopper in your payment form. You can [download the logo for Alipay](https://docs.adyen.com/online-payments/build-your-integration/advanced-flow/?platform=Web\&integration=API%2Bonly\&version=71#downloading-logos) to use in your form. ## Get Alipay as an available payment method When you make the [/paymentMethods](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods) to [get available payment methods](https://docs.adyen.com/online-payments/build-your-integration/advanced-flow/?platform=Web\&integration=API%20only#get-available-payment-methods), specify the following so that Alipay is included in the response. | Parameter | Values | | ------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [countryCode](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods#request-countryCode) | **AT, AU, BE, BG, CA, CH, CY, CZ, DE, DK, EE, ES, FI, FR, GB, GR, HK, HR, HU, ID, IS, IT, JP, KR, LT, LU, LV, MT, MY, NL, NO, NZ, PH, PL, PR, PT, RO, SE, SG, SI, SK, TH, TW, US, VN** | | [amount.currency](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods#request-amount-currency) | **AUD, CAD, CHF, DKK, EUR, GBP, HKD, JPY, MYR, NOK, NZD, SEK, SGD, THB, USD** | **Example request for available payment methods** #### curl ```bash curl https://checkout-test.adyen.com/v72/paymentMethods \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'idempotency-key: YOUR_IDEMPOTENCY_KEY' \ -H 'content-type: application/json' \ -X POST -d '{ "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "countryCode": "NL", "amount": { "currency": "EUR", "value": 1000 }, "shopperLocale": "nl-NL" }' ``` #### 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("EUR"); PaymentMethodsRequest paymentMethodsRequest = new PaymentMethodsRequest() .amount(amount) .merchantAccount("ADYEN_MERCHANT_ACCOUNT") .countryCode("NL"); // Send the request PaymentsApi service = new PaymentsApi(client); PaymentMethodsResponse response = service.paymentMethods(paymentMethodsRequest, 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("EUR"); $paymentMethodsRequest = new PaymentMethodsRequest(); $paymentMethodsRequest ->setAmount($amount) ->setMerchantAccount("ADYEN_MERCHANT_ACCOUNT") ->setCountryCode("NL"); $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new PaymentsApi($client); $response = $service->paymentMethods($paymentMethodsRequest, $requestOptions); ``` #### C\# ```cs // Adyen .NET API Library v34.0.0 to latest using System; 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 = "EUR" }; var paymentMethodsRequest = new PaymentMethodsRequest { Amount = amount, MerchantAccount = "ADYEN_MERCHANT_ACCOUNT", CountryCode = "NL" }; string idempotencyKey = Guid.NewGuid().ToString(); // Send the request var result = await paymentsService.PaymentMethodsAsync(paymentMethodsRequest, 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: "EUR" }; const paymentMethodsRequest = { amount: amount, merchantAccount: "ADYEN_MERCHANT_ACCOUNT", countryCode: "NL" }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = await checkoutAPI.PaymentsApi.paymentMethods(paymentMethodsRequest, { 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: "EUR", } paymentMethodsRequest := checkout.PaymentMethodsRequest{ Amount: &amount, MerchantAccount: "ADYEN_MERCHANT_ACCOUNT", CountryCode: common.PtrString("NL"), } // Send the request service := client.Checkout() req := service.PaymentsApi.PaymentMethodsInput().IdempotencyKey("UUID").PaymentMethodsRequest(paymentMethodsRequest) res, httpRes, err := service.PaymentsApi.PaymentMethods(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 = { "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "countryCode": "NL", "amount": { "currency": "EUR" }, "value": 1000 } # Send the request result = adyen.checkout.payments_api.payment_methods(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 = { "merchantAccount" => "ADYEN_MERCHANT_ACCOUNT", "countryCode" => "NL", "amount" => { "currency" => "EUR" }, "value" => 1000 } # Send the request result = adyen.checkout.payments_api.payment_methods(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 = { currency: "EUR" } as unknown as Types.checkout.Amount; const paymentMethodsRequest: Types.checkout.PaymentMethodsRequest = { amount: amount, merchantAccount: "ADYEN_MERCHANT_ACCOUNT", countryCode: "NL" }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = await checkoutAPI.PaymentsApi.paymentMethods(paymentMethodsRequest, { idempotencyKey: "UUID" }); ``` **Example response with Alipay available** ```json { "paymentMethods": [ { "name": "Alipay", "type": "alipay" } ] } ``` ## Add additional parameters to your /payments request You do not need to add any parameters when you [make a payment](https://docs.adyen.com/online-payments/build-your-integration/advanced-flow/?platform=Web\&integration=API%20only#make-a-payment). ## Test and go live You can test your Alipay integration in two ways: with the Adyen Payment Simulator, or directly with Alipay. ### Test with Adyen Use the Adyen Payment Simulator to verify that your Alipay integration works correctly with Adyen. You can test during development, before you go live, and after launch. The simulator does not recreate the shopper's journey through the Alipay app or website. This testing option is available by default when you add Alipay in your test Customer Area. The payment method type is `alipay`. To test a redirect payment: 1. Start a payment as usual in your integration. The shopper is redirected to an Adyen-hosted simulator page. 2. Select the payment outcome that you want to test. 3. Wait for the simulator to return the shopper to your website, then complete the payment as usual. For an Advanced flow, make a `/payments/details` request. 4. Confirm that your integration handles the outcome that you selected, and that the payment appears in your [Customer Area](https://ca-test.adyen.com/) > **Payments** > **Payment list**. ### Test directly with an Alipay wallet You can also test directly with an Alipay wallet: 1. Get an Alipay wallet app and set it up with a credit or debit card. 2. Make a live penny test, which is a payment for a minimal amount. View the details of your direct Alipay payments in your [live Customer Area](https://ca-live.adyen.com/) > **Payments** > **Payment list**. Before you can accept live Alipay payments, you need to submit a request for Alipay in your [live Customer Area](https://ca-live.adyen.com/). ## See also * [API-only integration guide](https://docs.adyen.com/online-payments/build-your-integration/advanced-flow/?platform=Web\&integration=API%20only)