--- title: "PayTo for API only" description: "Add PayTo to your API-only integration." url: "https://docs.adyen.com/payment-methods/payto/api-only" source_url: "https://docs.adyen.com/payment-methods/payto/api-only.md" canonical: "https://docs.adyen.com/payment-methods/payto/api-only" last_modified: "2026-10-09T12:57:19+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. # PayTo for API only Add PayTo to your API-only integration. You can add PayTo to your existing integration. The following instructions show only what you must add to your integration specifically for PayTo. If an instruction on this page corresponds with a step in the main integration guide, it includes a link to that 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). This page includes only instructions to add PayTo to your existing integration. | | | **Checkout API** | Make sure that you use Checkout API v70 or later. | | | **Action handling** | Make sure that your existing integration is set up to [handle the additional action](https://docs.adyen.com/online-payments/build-your-integration/advanced-flow/?platform=Web\&integration=API%20only#handle-the-redirect). `action.type`: **await**. | | | **Setup steps** | Before you begin, [add PayTo in your Customer Area](https://docs.adyen.com/payment-methods/add-payment-methods). | | ## Get PayTo 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 PayTo is included in the response. | Parameter | Values | | -------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | | [countryCode](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods#request-countryCode) | ****AU**** | | [amount.currency](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods#request-amount-currency) | ****AUD**** | | [shopperReference](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods#request-shopperReference) | Optional. Your shopper's unique ID to retrieve their stored payment methods. | ## Build your payment form We provide the logo for PayTo that [you can download](https://docs.adyen.com/online-payments/build-your-integration/advanced-flow/?platform=Web\&integration=API%20only#downloading-logos). Include PayTo in the list of available payment methods. You do not need to collect any information from the shopper in your payment form. ## 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=API%20only#make-a-payment), add the following parameters: The additional parameters that you include depends on the type of payment. * [One time payment](https://docs.adyen.com/payment-methods/payto/api-only#one-time-payment). * [Subscription setup and first payment](https://docs.adyen.com/payment-methods/payto/api-only#subscription-setup-and-first-payment). * [Subsequent subscription payment](https://docs.adyen.com/payment-methods/payto/api-only#subsequent-subscription-payment). ### One-time payment For one-time payments, add the following additional parameters. | Parameter | Required | Description | | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - | | [paymentMethod](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-paymentMethod) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **payto** | | | [paymentMethod.shopperAccountIdentifier](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-paymentMethod-listOfValues-shopperAccountIdentifier) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The shopper's banking details or PayID reference, used to complete the payment. [Possible values](https://docs.adyen.com/payment-methods/payto/api-only#values). 1 | | | [shopperName.firstName](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperName-firstName) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The shopper's first name. | | | [shopperName.lastName](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperName-lastName) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The shopper's last name. | | | [shopperStatement](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperStatement) | | The text that shows up on the shopper's statement. | | | [lineItems.quantity](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-quantity) | | The number of items From 0 to 9999. | | | [lineItems.sku](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-sku) | | Up to 200 characters. | | | [lineItems.description](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-description) | | Used to display the payment statement description to the shopper. Up to 280 characters. If multiple items, the item descriptions will be appended with a "," separator. | | | [lineItems.amountIncludingTax](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-amountIncludingTax) | | From 1 to 100000000. | | | [lineItems.itemCategory](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-itemCategory) | | Up to 200 characters. | | | [reference](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-reference) | | The reference to uniquely identify a payment. We recommend using a unique value per payment; however, it is not a requirement. Important: For PayTo, the maximum length is 35 characters. | | **Example request for one-time payments** #### 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 '{ "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "reference": "YOUR_REFERENCE", "amount": { "currency": "AUD", "value": 3000 }, "paymentMethod": { "type": "payto", "shopperAccountIdentifier": "PayID@example.com" }, "countryCode": "AU", "shopperName": { "firstName": "Simon", "lastName": "Hopper" }, "shopperReference": "YOUR_SHOPPER_REFERENCE", "returnUrl": "your-package-name.example.com/checkout?shopperOrder=12xy.." }' ``` #### 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("AUD") .value(3000L); ShopperName shopperName = new ShopperName() .firstName("Simon") .lastName("Hopper"); PayToDetails payToDetails = new PayToDetails() .shopperAccountIdentifier("PayID@example.com") .type(PayToDetails.TypeEnum.PAYTO); PaymentRequest paymentRequest = new PaymentRequest() .reference("YOUR_REFERENCE") .amount(amount) .shopperName(shopperName) .merchantAccount("ADYEN_MERCHANT_ACCOUNT") .countryCode("AU") .paymentMethod(new CheckoutPaymentMethod(payToDetails)) .returnUrl("your-package-name.example.com/checkout?shopperOrder=12xy..") .shopperReference("YOUR_SHOPPER_REFERENCE"); // 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("AUD") ->setValue(3000); $shopperName = new ShopperName(); $shopperName ->setFirstName("Simon") ->setLastName("Hopper"); $checkoutPaymentMethod = new CheckoutPaymentMethod(); $checkoutPaymentMethod ->setShopperAccountIdentifier("PayID@example.com") ->setType("payto"); $paymentRequest = new PaymentRequest(); $paymentRequest ->setReference("YOUR_REFERENCE") ->setAmount($amount) ->setShopperName($shopperName) ->setMerchantAccount("ADYEN_MERCHANT_ACCOUNT") ->setCountryCode("AU") ->setPaymentMethod($checkoutPaymentMethod) ->setReturnUrl("your-package-name.example.com/checkout?shopperOrder=12xy..") ->setShopperReference("YOUR_SHOPPER_REFERENCE"); $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 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 = "AUD", Value = 3000 }; var shopperName = new ShopperName { FirstName = "Simon", LastName = "Hopper" }; var payToDetails = new PayToDetails { ShopperAccountIdentifier = "PayID@example.com", Type = PayToDetails.TypeEnum.Payto }; var paymentRequest = new PaymentRequest { Reference = "YOUR_REFERENCE", Amount = amount, ShopperName = shopperName, MerchantAccount = "ADYEN_MERCHANT_ACCOUNT", CountryCode = "AU", PaymentMethod = new CheckoutPaymentMethod(payToDetails), ReturnUrl = "your-package-name.example.com/checkout?shopperOrder=12xy..", ShopperReference = "YOUR_SHOPPER_REFERENCE" }; 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: "AUD", value: 3000 }; const shopperName = { firstName: "Simon", lastName: "Hopper" }; const payToDetails = { shopperAccountIdentifier: "PayID@example.com", type: "payto" }; const paymentRequest = { reference: "YOUR_REFERENCE", amount: amount, shopperName: shopperName, merchantAccount: "ADYEN_MERCHANT_ACCOUNT", countryCode: "AU", paymentMethod: payToDetails, returnUrl: "your-package-name.example.com/checkout?shopperOrder=12xy..", shopperReference: "YOUR_SHOPPER_REFERENCE" }; // 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: "AUD", Value: 3000, } shopperName := checkout.ShopperName{ FirstName: "Simon", LastName: "Hopper", } payToDetails := checkout.PayToDetails{ ShopperAccountIdentifier: common.PtrString("PayID@example.com"), Type: common.PtrString("payto"), } paymentRequest := checkout.PaymentRequest{ Reference: "YOUR_REFERENCE", Amount: amount, ShopperName: &shopperName, MerchantAccount: "ADYEN_MERCHANT_ACCOUNT", CountryCode: common.PtrString("AU"), PaymentMethod: checkout.PayToDetailsAsCheckoutPaymentMethod(&payToDetails), ReturnUrl: "your-package-name.example.com/checkout?shopperOrder=12xy..", ShopperReference: common.PtrString("YOUR_SHOPPER_REFERENCE"), } // 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 = { "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "reference": "YOUR_REFERENCE", "amount": { "currency": "AUD", "value": 3000 }, "paymentMethod": { "type": "payto", "shopperAccountIdentifier": "PayID@example.com" }, "countryCode": "AU", "shopperName": { "firstName": "Simon", "lastName": "Hopper" }, "shopperReference": "YOUR_SHOPPER_REFERENCE", "returnUrl": "your-package-name.example.com/checkout?shopperOrder=12xy.." } # 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 = { "merchantAccount" => "ADYEN_MERCHANT_ACCOUNT", "reference" => "YOUR_REFERENCE", "amount" => { "currency" => "AUD", "value" => 3000 }, "paymentMethod" => { "type" => "payto", "shopperAccountIdentifier" => "PayID@example.com" }, "countryCode" => "AU", "shopperName" => { "firstName" => "Simon", "lastName" => "Hopper" }, "shopperReference" => "YOUR_SHOPPER_REFERENCE", "returnUrl" => "your-package-name.example.com/checkout?shopperOrder=12xy.." } # 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: "AUD", value: 3000 }; const shopperName: Types.checkout.ShopperName = { firstName: "Simon", lastName: "Hopper" }; const payToDetails: Types.checkout.PayToDetails = { shopperAccountIdentifier: "PayID@example.com", type: Types.checkout.PayToDetails.TypeEnum.Payto }; const paymentRequest: Types.checkout.PaymentRequest = { reference: "YOUR_REFERENCE", amount: amount, shopperName: shopperName, merchantAccount: "ADYEN_MERCHANT_ACCOUNT", countryCode: "AU", paymentMethod: payToDetails, returnUrl: "your-package-name.example.com/checkout?shopperOrder=12xy..", shopperReference: "YOUR_SHOPPER_REFERENCE" }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = await checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` The response includes: **Example response for one-time payments** #### curl ```bash curl https://checkout-test.adyen.com/v72/payments \ -H "x-API-key: ADYEN_API_KEY" \ -H "content-type: application/json" \ -d '{ "resultCode": "Pending", "action": { "paymentData": "Ab02....M9tFK", "paymentMethodType": "payto", "type": "await" } }' ``` #### 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) PaymentRequest paymentRequest = new PaymentRequest(); // 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) $paymentRequest = new PaymentRequest(); $paymentRequest; $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 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 paymentRequest = new PaymentRequest { }; 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 paymentRequest = { }; // 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) paymentRequest := checkout.PaymentRequest{ } // 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 = { "resultCode": "Pending", "action": { "paymentData": "Ab02....M9tFK", "paymentMethodType": "payto", "type": "await" } } # 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 = { "resultCode" => "Pending", "action" => { "paymentData" => "Ab02....M9tFK", "paymentMethodType" => "payto", "type" => "await" } } # 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 paymentRequest = { } as unknown as Types.checkout.PaymentRequest; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = await checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` ### Subscription setup and first payment To set up a subscription agreement with specific conditions and accept the first payment from the shopper, add the following parameters. | Parameter | Required | Description | | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | - | | [paymentMethod](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-paymentMethod) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **payto** | | | [paymentMethod.shopperAccountIdentifier](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-paymentMethod-listOfValues-shopperAccountIdentifier) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The shopper's banking details or PayID reference, used to complete the payment. [Possible values](https://docs.adyen.com/payment-methods/payto/api-only#values). 1 | | | [shopperName.firstName](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperName-firstName) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The shopper's first name. | | | [shopperName.lastName](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperName-lastName) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The shopper's last name. | | | [storePaymentMethod](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-storePaymentMethod) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Set to **true** to store payment details for subscription payments. | | | [recurringProcessingModel](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-recurringProcessingModel) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **Subscription** | | | [shopperInteraction](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperInteraction) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **Ecommerce** | | | [mandate.frequency](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-mandate-frequency) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The frequency with which a shopper should be charged. Possible values: adhoc, daily, weekly, biWeekly, monthly, quarterly, halfYearly, yearly. **adhoc**: Suitable for Card On File and Unscheduled Card On File recurring processing models. **daily**, **weekly**, **biWeekly**, **monthly**, **quarterly**, **halfYearly**, **yearly**: Suitable for Subscription recurring processing model. | | | [mandate.endsAt](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-mandate-endsAt) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | End date of the billing plan, in YYYY-MM-DD format. | | | [mandate.amount](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-mandate-amount) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The billing amount (in minor units) of the recurring transactions. 1 to 1000000000. | | | [mandate.amountRule](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-mandate-amountRule) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The limitation rule of the billing amount. Possible values: max: The transaction amount can not exceed the amount. exact: The transaction amount should be the same as the amount. | | | [mandate.remarks](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-mandate-remarks) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The agreement description shown to the shopper up to 140 characters. | | | [mandate.startsAt](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-mandate-startsAt) | | Start date of the billing plan, in YYYY-MM-DD format. By default, the transaction date. | | | [mandate.count](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-mandate-count) | | The number of transactions that can be performed within the given frequency. Conditions: If the frequency is different than `adhoc` the count has to be provided and should be >= 1 If frequency is `adhoc` the count can be omitted or will represent the total number of payments that can be done. | | | [shopperStatement](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperStatement) | | The text that shows up on the shopper's statement. Appears in Mandate Remarks in One-off payment flow, if no Remarks are provided. | | | [lineItems.quantity](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-quantity) **[1](https://docs.adyen.com/payment-methods/payto/api-only#lineitems)** | | From 0 to 9999. | | | [lineItems.sku](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-sku) **[1](https://docs.adyen.com/payment-methods/payto/api-only#lineitems)** | | Up to 200 characters. Note that this field is only available from v70 onwards. | | | [lineItems.description](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-description) **[1](https://docs.adyen.com/payment-methods/payto/api-only#lineitems)** | | Used to display the payment statement description to the shopper. Up to 280 characters. If multiple items, the item descriptions will be appended with a "," separator. | | | [lineItems.amountIncludingTax](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-amountIncludingTax) **[1](https://docs.adyen.com/payment-methods/payto/api-only#lineitems)** | | From 1 to 100000000. | | | [lineItems.itemCategory](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-itemCategory) **[1](https://docs.adyen.com/payment-methods/payto/api-only#lineitems)** | | Up to 200 characters. | | | [reference](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-reference) | | The reference to uniquely identify a payment. We recommend using a unique value per payment; however, it is not a requirement. Important: For PayTo, the maximum length is 35 characters. | | []()\ **1** The `lineItems` information are consolidated and provided to PayTo as the payment description, and can be shown in the shopper's banking app (depending on the bank's capabilities). The following example shows a payment request that gives the shopper a subscription agreement with a first payment of 30 AUD and a weekly payment of up to 90 AUD. | Parameter | Example value | Description | | -------------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------- | | `amount.value` | **3000** | After the shopper accepts the subscription agreement, they make a first, immediate payment of 30 AUD. | | `mandate.frequency` | **weekly** | A payment must be made weekly. | | `mandate.amount` | **9000** | The amount of the weekly payment. | | `mandate.amountRule` | **max** | The maximum amount of the weekly payment is the `mandate.amount` of 90 AUD. | | `mandate.count` | **1** | The shopper can make only one payment each week. | | `mandate.endsAt` | **2025-12-31** | The subscription agreement ends on December 31, 2025. | | `mandate.remarks` | **Your agreement description** | The description of the agreement that appears in the shopper agreement. | **Example request for subscriptions** #### 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 '{ "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "reference": "YOUR_REFERENCE", "amount": { "currency": "AUD", "value": 3000 }, "paymentMethod": { "type": "payto", "shopperAccountIdentifier": "PayID@example.com" }, "countryCode": "AU", "shopperName": { "firstName": "Simon", "lastName": "Hopper" }, "mandate":{ "frequency": "weekly", "endsAt": "2025-12-31", "amount": "9000", "amountRule": "max", "count": "1", "remarks": "Your agreement description" }, "shopperReference": "YOUR_SHOPPER_REFERENCE" "storePaymentMethod": true, "recurringProcessingModel": "Subscription", "shopperInteraction": "Ecommerce", "returnUrl": "your-package-name.example.com/checkout?shopperOrder=12xy.." }' ``` #### 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("AUD") .value(3000L); ShopperName shopperName = new ShopperName() .firstName("Simon") .lastName("Hopper"); Mandate mandate = new Mandate() .amount("9000") .amountRule(Mandate.AmountRuleEnum.MAX) .count("1") .endsAt("2025-12-31") .remarks("Your agreement description") .frequency(Mandate.FrequencyEnum.WEEKLY); PayToDetails payToDetails = new PayToDetails() .shopperAccountIdentifier("PayID@example.com") .type(PayToDetails.TypeEnum.PAYTO); PaymentRequest paymentRequest = new PaymentRequest() .reference("YOUR_REFERENCE") .amount(amount) .shopperName(shopperName) .mandate(mandate) .storePaymentMethod(true) .merchantAccount("ADYEN_MERCHANT_ACCOUNT") .countryCode("AU") .recurringProcessingModel(PaymentRequest.RecurringProcessingModelEnum.SUBSCRIPTION) .paymentMethod(new CheckoutPaymentMethod(payToDetails)) .shopperInteraction(PaymentRequest.ShopperInteractionEnum.ECOMMERCE) .returnUrl("your-package-name.example.com/checkout?shopperOrder=12xy..") .shopperReference("YOUR_SHOPPER_REFERENCE"); // 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("AUD") ->setValue(3000); $shopperName = new ShopperName(); $shopperName ->setFirstName("Simon") ->setLastName("Hopper"); $mandate = new Mandate(); $mandate ->setAmount("9000") ->setAmountRule("max") ->setCount("1") ->setEndsAt("2025-12-31") ->setRemarks("Your agreement description") ->setFrequency("weekly"); $checkoutPaymentMethod = new CheckoutPaymentMethod(); $checkoutPaymentMethod ->setShopperAccountIdentifier("PayID@example.com") ->setType("payto"); $paymentRequest = new PaymentRequest(); $paymentRequest ->setReference("YOUR_REFERENCE") ->setAmount($amount) ->setShopperName($shopperName) ->setMandate($mandate) ->setStorePaymentMethod(true) ->setMerchantAccount("ADYEN_MERCHANT_ACCOUNT") ->setCountryCode("AU") ->setRecurringProcessingModel("Subscription") ->setPaymentMethod($checkoutPaymentMethod) ->setShopperInteraction("Ecommerce") ->setReturnUrl("your-package-name.example.com/checkout?shopperOrder=12xy..") ->setShopperReference("YOUR_SHOPPER_REFERENCE"); $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 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 = "AUD", Value = 3000 }; var shopperName = new ShopperName { FirstName = "Simon", LastName = "Hopper" }; var mandate = new Mandate { Amount = "9000", AmountRule = Mandate.AmountRuleEnum.Max, Count = "1", EndsAt = "2025-12-31", Remarks = "Your agreement description", Frequency = Mandate.FrequencyEnum.Weekly }; var payToDetails = new PayToDetails { ShopperAccountIdentifier = "PayID@example.com", Type = PayToDetails.TypeEnum.Payto }; var paymentRequest = new PaymentRequest { Reference = "YOUR_REFERENCE", Amount = amount, ShopperName = shopperName, Mandate = mandate, StorePaymentMethod = true, MerchantAccount = "ADYEN_MERCHANT_ACCOUNT", CountryCode = "AU", RecurringProcessingModel = PaymentRequest.RecurringProcessingModelEnum.Subscription, PaymentMethod = new CheckoutPaymentMethod(payToDetails), ShopperInteraction = PaymentRequest.ShopperInteractionEnum.Ecommerce, ReturnUrl = "your-package-name.example.com/checkout?shopperOrder=12xy..", ShopperReference = "YOUR_SHOPPER_REFERENCE" }; 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: "AUD", value: 3000 }; const shopperName = { firstName: "Simon", lastName: "Hopper" }; const mandate = { amount: "9000", amountRule: "max", count: "1", endsAt: "2025-12-31", remarks: "Your agreement description", frequency: "weekly" }; const payToDetails = { shopperAccountIdentifier: "PayID@example.com", type: "payto" }; const paymentRequest = { reference: "YOUR_REFERENCE", amount: amount, shopperName: shopperName, mandate: mandate, storePaymentMethod: true, merchantAccount: "ADYEN_MERCHANT_ACCOUNT", countryCode: "AU", recurringProcessingModel: "Subscription", paymentMethod: payToDetails, shopperInteraction: "Ecommerce", returnUrl: "your-package-name.example.com/checkout?shopperOrder=12xy..", shopperReference: "YOUR_SHOPPER_REFERENCE" }; // 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: "AUD", Value: 3000, } shopperName := checkout.ShopperName{ FirstName: "Simon", LastName: "Hopper", } mandate := checkout.Mandate{ Amount: "9000", AmountRule: common.PtrString("max"), Count: common.PtrString("1"), EndsAt: "2025-12-31", Remarks: common.PtrString("Your agreement description"), Frequency: "weekly", } payToDetails := checkout.PayToDetails{ ShopperAccountIdentifier: common.PtrString("PayID@example.com"), Type: common.PtrString("payto"), } paymentRequest := checkout.PaymentRequest{ Reference: "YOUR_REFERENCE", Amount: amount, ShopperName: &shopperName, Mandate: &mandate, StorePaymentMethod: common.PtrBool(true), MerchantAccount: "ADYEN_MERCHANT_ACCOUNT", CountryCode: common.PtrString("AU"), RecurringProcessingModel: common.PtrString("Subscription"), PaymentMethod: checkout.PayToDetailsAsCheckoutPaymentMethod(&payToDetails), ShopperInteraction: common.PtrString("Ecommerce"), ReturnUrl: "your-package-name.example.com/checkout?shopperOrder=12xy..", ShopperReference: common.PtrString("YOUR_SHOPPER_REFERENCE"), } // 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 = { "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "reference": "YOUR_REFERENCE", "amount": { "currency": "AUD", "value": 3000 }, "paymentMethod": { "type": "payto", "shopperAccountIdentifier": "PayID@example.com" }, "countryCode": "AU", "shopperName": { "firstName": "Simon", "lastName": "Hopper" }, "mandate": { "frequency": "weekly", "endsAt": "2025-12-31", "amount": "9000", "amountRule": "max", "count": "1", "remarks": "Your agreement description" }, "shopperReference": "YOUR_SHOPPER_REFERENCE", "storePaymentMethod": True, "recurringProcessingModel": "Subscription", "shopperInteraction": "Ecommerce", "returnUrl": "your-package-name.example.com/checkout?shopperOrder=12xy.." } # 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 = { "merchantAccount" => "ADYEN_MERCHANT_ACCOUNT", "reference" => "YOUR_REFERENCE", "amount" => { "currency" => "AUD", "value" => 3000 }, "paymentMethod" => { "type" => "payto", "shopperAccountIdentifier" => "PayID@example.com" }, "countryCode" => "AU", "shopperName" => { "firstName" => "Simon", "lastName" => "Hopper" }, "mandate" => { "frequency" => "weekly", "endsAt" => "2025-12-31", "amount" => "9000", "amountRule" => "max", "count" => "1", "remarks" => "Your agreement description" }, "shopperReference" => "YOUR_SHOPPER_REFERENCE", "storePaymentMethod" => true, "recurringProcessingModel" => "Subscription", "shopperInteraction" => "Ecommerce", "returnUrl" => "your-package-name.example.com/checkout?shopperOrder=12xy.." } # 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: "AUD", value: 3000 }; const shopperName: Types.checkout.ShopperName = { firstName: "Simon", lastName: "Hopper" }; const mandate: Types.checkout.Mandate = { amount: "9000", amountRule: Types.checkout.Mandate.AmountRuleEnum.Max, count: "1", endsAt: "2025-12-31", remarks: "Your agreement description", frequency: Types.checkout.Mandate.FrequencyEnum.Weekly }; const payToDetails: Types.checkout.PayToDetails = { shopperAccountIdentifier: "PayID@example.com", type: Types.checkout.PayToDetails.TypeEnum.Payto }; const paymentRequest: Types.checkout.PaymentRequest = { reference: "YOUR_REFERENCE", amount: amount, shopperName: shopperName, mandate: mandate, storePaymentMethod: true, merchantAccount: "ADYEN_MERCHANT_ACCOUNT", countryCode: "AU", recurringProcessingModel: Types.checkout.PaymentRequest.RecurringProcessingModelEnum.Subscription, paymentMethod: payToDetails, shopperInteraction: Types.checkout.PaymentRequest.ShopperInteractionEnum.Ecommerce, returnUrl: "your-package-name.example.com/checkout?shopperOrder=12xy..", shopperReference: "YOUR_SHOPPER_REFERENCE" }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = await checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` The response includes: **Example response for subscriptions** #### curl ```bash curl https://checkout-test.adyen.com/v72/payments \ -H "x-API-key: ADYEN_API_KEY" \ -H "content-type: application/json" \ -d '{ "resultCode": "Pending", "action": { "paymentData": "Ab02....M9tFK", "paymentMethodType": "payto", "type": "await" } }' ``` #### 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) PaymentRequest paymentRequest = new PaymentRequest(); // 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) $paymentRequest = new PaymentRequest(); $paymentRequest; $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 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 paymentRequest = new PaymentRequest { }; 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 paymentRequest = { }; // 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) paymentRequest := checkout.PaymentRequest{ } // 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 = { "resultCode": "Pending", "action": { "paymentData": "Ab02....M9tFK", "paymentMethodType": "payto", "type": "await" } } # 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 = { "resultCode" => "Pending", "action" => { "paymentData" => "Ab02....M9tFK", "paymentMethodType" => "payto", "type" => "await" } } # 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 paymentRequest = { } as unknown as Types.checkout.PaymentRequest; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = await checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` The shopper receives a notification from their bank (through SMS, email, or in their banking app) to authorize or decline the agreement. When the subscription agreement is accepted, you get the [RECURRING\_CONTRACT](https://docs.adyen.com/api-explorer/Webhooks/latest/post/RECURRING_CONTRACT) webhook that includes the `recurringDetailReference` for subsequent subscription payments. ### Subsequent subscription payment For a subsequent subscription payment, add the following parameters. | Parameter | Required | Description | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [paymentMethod](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-paymentMethod) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **payto** | | [paymentMethod.storedPaymentMethodId](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-paymentMethod-PayToDetails-storedPaymentMethodId) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | From the [recurring.token.created](https://docs.adyen.com/api-explorer/Tokenization-webhooks/latest/post/recurring.token.created) webhook associated with the shopper, the `data.storedPaymentMethodId`. This stored payment method can only be used according to the conditions specified in the subscription agreement. | | [shopperInteraction](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperInteraction) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **ContAuth** | | [reference](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-reference) | | The reference to uniquely identify a payment. We recommend using a unique value per payment; however, it is not a requirement. Important: For PayTo, the maximum length is 35 characters. | **Example request for subsequent payments** #### 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 '{ "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "reference": "YOUR_REFERENCE", "amount": { "currency": "AUD", "value": 3000 }, "paymentMethod": { "type": "payto", "storedPaymentMethodId": "FKSPNCQ8HXSKGK82" }, "shopperReference": "YOUR_SHOPPER_REFERENCE" "recurringProcessingModel": "Subscription", "shopperInteraction": "ContAuth" }' ``` #### 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("AUD") .value(3000L); PayToDetails payToDetails = new PayToDetails() .storedPaymentMethodId("FKSPNCQ8HXSKGK82") .type(PayToDetails.TypeEnum.PAYTO); PaymentRequest paymentRequest = new PaymentRequest() .reference("YOUR_REFERENCE") .amount(amount) .merchantAccount("ADYEN_MERCHANT_ACCOUNT") .recurringProcessingModel(PaymentRequest.RecurringProcessingModelEnum.SUBSCRIPTION) .paymentMethod(new CheckoutPaymentMethod(payToDetails)) .shopperInteraction(PaymentRequest.ShopperInteractionEnum.CONTAUTH) .shopperReference("YOUR_SHOPPER_REFERENCE"); // 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("AUD") ->setValue(3000); $checkoutPaymentMethod = new CheckoutPaymentMethod(); $checkoutPaymentMethod ->setStoredPaymentMethodId("FKSPNCQ8HXSKGK82") ->setType("payto"); $paymentRequest = new PaymentRequest(); $paymentRequest ->setReference("YOUR_REFERENCE") ->setAmount($amount) ->setMerchantAccount("ADYEN_MERCHANT_ACCOUNT") ->setRecurringProcessingModel("Subscription") ->setPaymentMethod($checkoutPaymentMethod) ->setShopperInteraction("ContAuth") ->setShopperReference("YOUR_SHOPPER_REFERENCE"); $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 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 = "AUD", Value = 3000 }; var payToDetails = new PayToDetails { StoredPaymentMethodId = "FKSPNCQ8HXSKGK82", Type = PayToDetails.TypeEnum.Payto }; var paymentRequest = new PaymentRequest { Reference = "YOUR_REFERENCE", Amount = amount, MerchantAccount = "ADYEN_MERCHANT_ACCOUNT", RecurringProcessingModel = PaymentRequest.RecurringProcessingModelEnum.Subscription, PaymentMethod = new CheckoutPaymentMethod(payToDetails), ShopperInteraction = PaymentRequest.ShopperInteractionEnum.ContAuth, ShopperReference = "YOUR_SHOPPER_REFERENCE" }; 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: "AUD", value: 3000 }; const payToDetails = { storedPaymentMethodId: "FKSPNCQ8HXSKGK82", type: "payto" }; const paymentRequest = { reference: "YOUR_REFERENCE", amount: amount, merchantAccount: "ADYEN_MERCHANT_ACCOUNT", recurringProcessingModel: "Subscription", paymentMethod: payToDetails, shopperInteraction: "ContAuth", shopperReference: "YOUR_SHOPPER_REFERENCE" }; // 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: "AUD", Value: 3000, } payToDetails := checkout.PayToDetails{ StoredPaymentMethodId: common.PtrString("FKSPNCQ8HXSKGK82"), Type: common.PtrString("payto"), } paymentRequest := checkout.PaymentRequest{ Reference: "YOUR_REFERENCE", Amount: amount, MerchantAccount: "ADYEN_MERCHANT_ACCOUNT", RecurringProcessingModel: common.PtrString("Subscription"), PaymentMethod: checkout.PayToDetailsAsCheckoutPaymentMethod(&payToDetails), ShopperInteraction: common.PtrString("ContAuth"), ShopperReference: common.PtrString("YOUR_SHOPPER_REFERENCE"), } // 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 = { "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "reference": "YOUR_REFERENCE", "amount": { "currency": "AUD", "value": 3000 }, "paymentMethod": { "type": "payto", "storedPaymentMethodId": "FKSPNCQ8HXSKGK82" }, "shopperReference": "YOUR_SHOPPER_REFERENCE", "recurringProcessingModel": "Subscription", "shopperInteraction": "ContAuth" } # 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 = { "merchantAccount" => "ADYEN_MERCHANT_ACCOUNT", "reference" => "YOUR_REFERENCE", "amount" => { "currency" => "AUD", "value" => 3000 }, "paymentMethod" => { "type" => "payto", "storedPaymentMethodId" => "FKSPNCQ8HXSKGK82" }, "shopperReference" => "YOUR_SHOPPER_REFERENCE", "recurringProcessingModel" => "Subscription", "shopperInteraction" => "ContAuth" } # 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: "AUD", value: 3000 }; const payToDetails: Types.checkout.PayToDetails = { storedPaymentMethodId: "FKSPNCQ8HXSKGK82", type: Types.checkout.PayToDetails.TypeEnum.Payto }; const paymentRequest = { reference: "YOUR_REFERENCE", amount: amount, merchantAccount: "ADYEN_MERCHANT_ACCOUNT", recurringProcessingModel: Types.checkout.PaymentRequest.RecurringProcessingModelEnum.Subscription, paymentMethod: payToDetails, shopperInteraction: Types.checkout.PaymentRequest.ShopperInteractionEnum.ContAuth, shopperReference: "YOUR_SHOPPER_REFERENCE" } as unknown as Types.checkout.PaymentRequest; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = await checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` The response includes: **Example response for subsequent payments** #### curl ```bash curl https://checkout-test.adyen.com/v72/payments \ -H "x-API-key: ADYEN_API_KEY" \ -H "content-type: application/json" \ -d '{ "additionalData": { "bankAccount.ownerName": null, "recurring.contractTypes": "RECURRING", "recurring.recurringDetailReference": "FKSPNCQ8HXSKGK82", "recurringProcessingModel": "Subscription", "recurring.shopperReference": "YOUR_SHOPPER_REFERENCE", "tokenization.shopperReference": "YOUR_SHOPPER_REFERENCE", "recurring.firstPspReference": "ZMXFX8BFHT7ST8Q2", "tokenization.storedPaymentMethodId": "FKSPNCQ8HXSKGK82", "bankAccount.iban": null }, "pspReference": "PPJT7Z8LGBT8W8G2", "resultCode": "Received", "merchantReference": "YOUR_REFERENCE" }' ``` #### 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) PaymentRequest paymentRequest = new PaymentRequest() .additionalData(new HashMap(Map.of( "bankAccount.ownerName", "null", "recurring.contractTypes", "RECURRING", "recurring.recurringDetailReference", "FKSPNCQ8HXSKGK82", "recurringProcessingModel", "Subscription", "recurring.shopperReference", "YOUR_SHOPPER_REFERENCE", "tokenization.shopperReference", "YOUR_SHOPPER_REFERENCE", "recurring.firstPspReference", "ZMXFX8BFHT7ST8Q2", "tokenization.storedPaymentMethodId", "FKSPNCQ8HXSKGK82", "bankAccount.iban", "null" ))); // 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) $paymentRequest = new PaymentRequest(); $paymentRequest ->setAdditionalData( array( "bankAccount.ownerName" => "null", "recurring.contractTypes" => "RECURRING", "recurring.recurringDetailReference" => "FKSPNCQ8HXSKGK82", "recurringProcessingModel" => "Subscription", "recurring.shopperReference" => "YOUR_SHOPPER_REFERENCE", "tokenization.shopperReference" => "YOUR_SHOPPER_REFERENCE", "recurring.firstPspReference" => "ZMXFX8BFHT7ST8Q2", "tokenization.storedPaymentMethodId" => "FKSPNCQ8HXSKGK82", "bankAccount.iban" => "null" ) ); $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 paymentRequest = new PaymentRequest { AdditionalData = new Dictionary { { "bankAccount.ownerName", "null" }, { "recurring.contractTypes", "RECURRING" }, { "recurring.recurringDetailReference", "FKSPNCQ8HXSKGK82" }, { "recurringProcessingModel", "Subscription" }, { "recurring.shopperReference", "YOUR_SHOPPER_REFERENCE" }, { "tokenization.shopperReference", "YOUR_SHOPPER_REFERENCE" }, { "recurring.firstPspReference", "ZMXFX8BFHT7ST8Q2" }, { "tokenization.storedPaymentMethodId", "FKSPNCQ8HXSKGK82" }, { "bankAccount.iban", "null" } } }; 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 paymentRequest = { additionalData: { "bankAccount.ownerName": "null", "recurring.contractTypes": "RECURRING", "recurring.recurringDetailReference": "FKSPNCQ8HXSKGK82", "recurringProcessingModel": "Subscription", "recurring.shopperReference": "YOUR_SHOPPER_REFERENCE", "tokenization.shopperReference": "YOUR_SHOPPER_REFERENCE", "recurring.firstPspReference": "ZMXFX8BFHT7ST8Q2", "tokenization.storedPaymentMethodId": "FKSPNCQ8HXSKGK82", "bankAccount.iban": "null" } }; // 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) paymentRequest := checkout.PaymentRequest{ AdditionalData: &map[string]string{ "bankAccount.ownerName": "null", "recurring.contractTypes": "RECURRING", "recurring.recurringDetailReference": "FKSPNCQ8HXSKGK82", "recurringProcessingModel": "Subscription", "recurring.shopperReference": "YOUR_SHOPPER_REFERENCE", "tokenization.shopperReference": "YOUR_SHOPPER_REFERENCE", "recurring.firstPspReference": "ZMXFX8BFHT7ST8Q2", "tokenization.storedPaymentMethodId": "FKSPNCQ8HXSKGK82", "bankAccount.iban": "null", }, } // 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 = { "additionalData": { "bankAccount.ownerName": None, "recurring.contractTypes": "RECURRING", "recurring.recurringDetailReference": "FKSPNCQ8HXSKGK82", "recurringProcessingModel": "Subscription", "recurring.shopperReference": "YOUR_SHOPPER_REFERENCE", "tokenization.shopperReference": "YOUR_SHOPPER_REFERENCE", "recurring.firstPspReference": "ZMXFX8BFHT7ST8Q2", "tokenization.storedPaymentMethodId": "FKSPNCQ8HXSKGK82", "bankAccount.iban": None }, "pspReference": "PPJT7Z8LGBT8W8G2", "resultCode": "Received", "merchantReference": "YOUR_REFERENCE" } # 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 = { "additionalData" => { "bankAccount.ownerName" => nil, "recurring.contractTypes" => "RECURRING", "recurring.recurringDetailReference" => "FKSPNCQ8HXSKGK82", "recurringProcessingModel" => "Subscription", "recurring.shopperReference" => "YOUR_SHOPPER_REFERENCE", "tokenization.shopperReference" => "YOUR_SHOPPER_REFERENCE", "recurring.firstPspReference" => "ZMXFX8BFHT7ST8Q2", "tokenization.storedPaymentMethodId" => "FKSPNCQ8HXSKGK82", "bankAccount.iban" => nil }, "pspReference" => "PPJT7Z8LGBT8W8G2", "resultCode" => "Received", "merchantReference" => "YOUR_REFERENCE" } # 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 paymentRequest = { additionalData: { "bankAccount.ownerName": "null", "recurring.contractTypes": "RECURRING", "recurring.recurringDetailReference": "FKSPNCQ8HXSKGK82", "recurringProcessingModel": "Subscription", "recurring.shopperReference": "YOUR_SHOPPER_REFERENCE", "tokenization.shopperReference": "YOUR_SHOPPER_REFERENCE", "recurring.firstPspReference": "ZMXFX8BFHT7ST8Q2", "tokenization.storedPaymentMethodId": "FKSPNCQ8HXSKGK82", "bankAccount.iban": "null" } } as unknown as Types.checkout.PaymentRequest; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = await checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` ### Shopper account identifiers The following table shows the possible values you can use for the `shopperAccountIdentifier` parameter. | Identifier | Regular expression (RegEx) for allowed values | | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | | BSB-AccountNumber | `` ^\d{6}-[ -~]{1,28}$` `` | | PayID Email | ``^(?:[a-z0-9!#$%&'+\/=?^_`{\|}~-]+(?:.[a-z0-9!#$%&'+\/=?^_`{\|}~-]+)@(?:[a-z0-9] (?:[a-z0-9-][a-z0-9])?.)+[a-z0-9] (?:[a-z0-9-]*[a-z0-9])?)$`` | | PayID Phone Number | `^+[0-9]{1,3}-[1-9]{1,1}[0-9]{1,29}$` | | PayID ABN | `^((\d{9})\|(\d{11}))$` | | PayID Organisation Identifier | `^[!-@[-~][ -@[-~]{0,254}[!-@[-~]$` | ### Required webhooks The following webhook notifications indicate the status of the transaction. **OFFER\_CLOSED** This notification will be returned when the agreement failed or is canceled by the user.\ In this case, the `refusalReasonRaw` will be included in the `additionalData` object in the format `errorCode:errorDescription`. The contents of `refusalReasonRaw` will provide details about the reason for the failure or cancellation. Process the `refusalReasonRaw` to obtain more information about the decline or cancellation reason. **AUTHORISATION** You will receive this notification for a payment on an accepted agreement, the payment outcome could be authorized or rejected.\ In case the payment fails due to an error, you can consume the `refusalReasonRaw` that is returned in the `additionalData` object of your notification to get additional information about the reason for the payment being refused. **REFUND** When the refund is successfully received, the outcome will most likely succeed unless you receive a REFUND\_FAILED notification. **REFUND\_FAILED** Because refunds are asynchronous events, the outcome might fail due to unexpected reasons. In such cases you will receive a REFUND\_FAILED notification. **RECURRING\_CONTRACT** Contains the token in the payload of the notification sent to you in the `pspReference` parameter. **DISABLE\_RECURRING** When an agreement arrives to term, or is canceled (by you or the shopper), you will receive a DISABLE\_RECURRING notification to keep you informed about a token deletion. [Token lifecycle webhooks](https://docs.adyen.com/online-payments/tokenization/managing-tokens/#webhooks) are also supported. ## Test and go live To test, use the `shopperAccountIdentifier` with the following emails to simulate testing scenarios: | Type | shopperAccountIdentifier | Result | Description | | --------- | ------------------------------------------------------ | ------------- | ------------------------------------------------------------------------- | | Agreement | \[Any valid input] | Authorised | Successful payment. | | | expire\@adyen-test.com | OFFER\_CLOSED | The Agreement has expired, please request your shopper to pay again. | | | debtor\_account\_type\_not\_supported\@adyen-test.com | OFFER\_CLOSED | The agreement has been refused. | | Payment | \[Any valid input] | Authorised | Successful payment. | | | insufficient\_funds\@adyen-test.com | Refused | Insufficient Funds | | | debtor\_account\_closed\@adyen-test.com | Refused | The Shopper account is closed. | | | financial\_infrastructure\_unavailable\@adyen-test.com | Error | NPP is unable to process the payment due to back office issues or outage. | ## See also * [API-only integration guide](https://docs.adyen.com/online-payments/build-your-integration/advanced-flow/?platform=Web\&integration=API%20only) * [PayTo raw responses](https://docs.adyen.com/development-resources/raw-acquirer-responses#payto-raw-responses)