--- title: "BACS Direct Debit Android Component" description: "Add BACS Direct Debit to your Components integration." url: "https://docs.adyen.com/payment-methods/bacs/android-component" source_url: "https://docs.adyen.com/payment-methods/bacs/android-component.md" canonical: "https://docs.adyen.com/payment-methods/bacs/android-component" last_modified: "2026-05-22T12:56:54+02:00" language: "en" --- # BACS Direct Debit Android Component Add BACS Direct Debit to your Components integration. [View source](/payment-methods/bacs/android-component.md) You can add BACS Direct Debit to your existing integration. The following instructions show only what you must add to your integration specifically for BACS Direct Debit. 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](/online-payments/build-your-integration) that your integration uses: ## Sessions flow Component ### Before-You-Begin ## Requirements | Requirement | Description | | | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - | | **Integration type** | Make sure that you have an existing Sessions flow [Android Components integration](/online-payments/build-your-integration/sessions-flow?platform=Android\&integration=Components). | | | **Checkout API** | Make sure that you use Checkout API v68 or later. | | | **Setup steps** | Before you begin, [add BACS Direct Debit in your Customer Area](/payment-methods/add-payment-methods). | | ### Add-Parameters-Sessions-Request ## Add additional parameters to your /sessions request When you [create a payment session](/online-payments/build-your-integration/sessions-flow?platform=Android\&integration=Components#create-a-payment-session), add the following parameters: | Parameter | Required | Description | | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------- | ------------------------- | | [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 email of the shopper. | **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 '{ "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "amount": { "value": 1000, "currency": "GBP" }, "returnUrl": "adyencheckout://your.package.name", "reference": "YOUR_PAYMENT_REFERENCE", "countryCode": "GB", "shopperEmail":"s.hopper@gmail.com" }' ``` #### Java ```java // Adyen Java API Library v40.0.0 import com.adyen.Client; import com.adyen.enums.Environment; import com.adyen.model.checkout.*; import java.time.OffsetDateTime; import java.util.*; import com.adyen.model.RequestOptions; import com.adyen.service.checkout.*; // For the LIVE environment, also include your liveEndpointUrlPrefix. Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Create the request object(s) Amount amount = new Amount() .currency("GBP") .value(1000L); CreateCheckoutSessionRequest createCheckoutSessionRequest = new CreateCheckoutSessionRequest() .reference("YOUR_PAYMENT_REFERENCE") .amount(amount) .merchantAccount("ADYEN_MERCHANT_ACCOUNT") .countryCode("GB") .shopperEmail("s.hopper@gmail.com") .returnUrl("adyencheckout://your.package.name"); // 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) $amount = new Amount(); $amount ->setCurrency("GBP") ->setValue(1000); $createCheckoutSessionRequest = new CreateCheckoutSessionRequest(); $createCheckoutSessionRequest ->setReference("YOUR_PAYMENT_REFERENCE") ->setAmount($amount) ->setMerchantAccount("ADYEN_MERCHANT_ACCOUNT") ->setCountryCode("GB") ->setShopperEmail("s.hopper@gmail.com") ->setReturnUrl("adyencheckout://your.package.name"); $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new PaymentsApi($client); $response = $service->sessions($createCheckoutSessionRequest, $requestOptions); ``` #### C\# ```cs // Adyen .NET API Library v32.2.1 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.Checkout; using Adyen.Service.Checkout; // For the LIVE environment, also include your liveEndpointUrlPrefix. var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Create the request object(s) Amount amount = new Amount { Currency = "GBP", Value = 1000 }; CreateCheckoutSessionRequest createCheckoutSessionRequest = new CreateCheckoutSessionRequest { Reference = "YOUR_PAYMENT_REFERENCE", Amount = amount, MerchantAccount = "ADYEN_MERCHANT_ACCOUNT", CountryCode = "GB", ShopperEmail = "s.hopper@gmail.com", ReturnUrl = "adyencheckout://your.package.name" }; // Send the request var service = new PaymentsService(client); var response = service.Sessions(createCheckoutSessionRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"}); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v30.0.0 const { Client, 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 createCheckoutSessionRequest = { merchantAccount: "ADYEN_MERCHANT_ACCOUNT", amount: { value: 1000, currency: "GBP" }, returnUrl: "adyencheckout://your.package.name", reference: "YOUR_PAYMENT_REFERENCE", countryCode: "GB", shopperEmail: "s.hopper@gmail.com" } // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.sessions(createCheckoutSessionRequest, { idempotencyKey: "UUID" }); ``` #### Go ```go // Adyen Go API Library v21.1.0 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, } createCheckoutSessionRequest := checkout.CreateCheckoutSessionRequest{ Reference: "YOUR_PAYMENT_REFERENCE", Amount: amount, MerchantAccount: "ADYEN_MERCHANT_ACCOUNT", CountryCode: common.PtrString("GB"), ShopperEmail: common.PtrString("s.hopper@gmail.com"), ReturnUrl: "adyencheckout://your.package.name", } // 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 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", "amount": { "value": 1000, "currency": "GBP" }, "returnUrl": "adyencheckout://your.package.name", "reference": "YOUR_PAYMENT_REFERENCE", "countryCode": "GB", "shopperEmail": "s.hopper@gmail.com" } # Send the request result = adyen.checkout.payments_api.sessions(request=json_request, idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v11.0.0 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', :amount => { :value => 1000, :currency => 'GBP' }, :returnUrl => 'adyencheckout://your.package.name', :reference => 'YOUR_PAYMENT_REFERENCE', :countryCode => 'GB', :shopperEmail => 's.hopper@gmail.com' } # 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 import { Client, 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 createCheckoutSessionRequest: Types.checkout.CreateCheckoutSessionRequest = { reference: "YOUR_PAYMENT_REFERENCE", amount: amount, merchantAccount: "ADYEN_MERCHANT_ACCOUNT", countryCode: "GB", shopperEmail: "s.hopper@gmail.com", returnUrl: "adyencheckout://your.package.name" }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.sessions(createCheckoutSessionRequest, { idempotencyKey: "UUID" }); ``` ### Import-Component ## Import the Component for BACS Direct Debit To [import the library](/online-payments/build-your-integration/sessions-flow?platform=Android\&integration=Components#import) and include the module for BACS Direct Debit. ### Tab: With Jetpack Compose **Import the module with Compose** ```java implementation "com.adyen.checkout:bacs:YOUR_VERSION" implementation "com.adyen.checkout:components-compose:YOUR_VERSION" ``` ### Tab: Without Jetpack Compose **Import the module without Compose** ```java implementation "com.adyen.checkout:bacs:YOUR_VERSION" ``` ### Add-Configuration ## Add additional configuration for BACS Direct Debit [Add a configuration object](/online-payments/build-your-integration/sessions-flow?platform=Android\&integration=Components#3-optional-add-a-configuration-object) with the following parameters: | Parameter | Required | Description | | ---------------------- | -------- | -------------------------------------------------------------------- | | setSubmitButtonVisible | | Set to **false** to hide the submit button. The default is **true**. | **Add a configuration object** ```kotlin CheckoutConfiguration( ... ) { bacs { setSubmitButtonVisible(value) } } ``` ### Launch-And-Show ## Launch and show the Component for BACS Direct Debit To [create the Component](/online-payments/build-your-integration/sessions-flow?platform=Android\&integration=Components#launch-and-show) for BACS Direct Debit, use the `BacsDirectDebitComponent` class. ### Tab: With Jetpack Compose **Launch and show the Component** ```kotlin import com.adyen.checkout.components.compose.get // Get the payment method. val paymentMethod = checkoutSession.getPaymentMethod(PaymentMethodTypes.BACS) @Composable private fun ComposableBacsDirectDebitComponent() { // Keep a reference to this Component in case you need to access it later. val bacsComponent = BacsDirectDebitComponent.PROVIDER.get( checkoutSession = checkoutSession, paymentMethod = paymentMethod, configuration = checkoutConfiguration, componentCallback = callback, // This key is required to ensure a new Component gets created for each different screen or payment session. // Generate a new value for this key every time you need to reset the Component. key = "YOUR_UNIQUE_KEY_FOR_THIS_COMPONENT", ) // This is your composable, a wrapper around our xml view. AdyenComponent( component = bacsComponent, modifier = YOUR_MODIFIER, ) } ``` ### Tab: Without Jetpack Compose ```kotlin // Get the payment method. val paymentMethod = checkoutSession.getPaymentMethod(PaymentMethodTypes.BACS) val bacsComponent = BacsDirectDebitComponent.PROVIDER.get( activity, // Your activity or fragment. checkoutSession, paymentMethod, checkoutConfiguration, componentCallback ) // Attach the Component to your view. binding.bacsView.attach(bacsComponent, activity) // Your activity or fragment. ``` ### Recurring ## Recurring payments If you have a recurring or subscription business model, we recommend tokenizing the shopper's payment details. When you create a shopper token from a BACS Direct Debit payment, we store the shopper's payment details with the token. You can use this token to make recurring BACS Direct Debit payments. You need to use the [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) endpoint to [make recurring payments with the token](#make-recurring-payments). We strongly recommend that you request explicit permission from the shopper if you intend to make recurring BACS Direct Debit payments. Being transparent about the payment schedule and the amount they will be charged will reduce the risk of [chargebacks](/get-started-with-adyen/adyen-glossary/#chargeback). Under the [Direct Debit Guarantee](https://www.directdebit.co.uk/direct-debit-explained/direct-debit-guarantee), if there is a change in the collection date or the amount, you must give the shopper advance notice of the payment. ### Create shopper token [Tokenize the shopper's payment details](/online-payments/tokenization/make-token-payments) when you make the initial BACS Direct Debit payment. 1. When you make a POST request to [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) to make a payment, additionally include: * `shopperReference`: Your unique ID for this shopper. * `storePaymentMethod`: **true**. 2. When you receive the [recurring.token.created](https://docs.adyen.com/api-explorer/Tokenization-webhooks/latest/post/recurring.token.created), store the `storedPaymentMethodId`. This is the token you will need to make recurring payments for this shopper. ### Make recurring payments We strongly recommend giving shoppers advance notice before each payment. For each recurring payment for this shopper, make a BACS Direct Debit payment with a POST request to the [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) endpoint, and additionally include: * `paymentMethod.recurringDetailReference` or `paymentMethod.storedPaymentMethodId`for API v49 and above. This is the `storedPaymentMethodId` returned in the [recurring.token.created](https://docs.adyen.com/api-explorer/Tokenization-webhooks/latest/post/recurring.token.created) webhook when you created the token. * `shopperReference`: the unique shopper ID you used to create the shopper token. * `shopperInteraction`: **ContAuth**. ```json { "merchantAccount":"YOUR_MERCHANT_ACCOUNT", "reference":"BACS test payment", "shopperReference":"YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j", "shopperInteraction":"ContAuth", "amount":{ "currency":"GBP", "value":49900 }, "paymentMethod":{ "type":"directdebit_GB", "storedPaymentMethodId":"7219687191761347" }, "countryCode":"GB", "shopperLocale":"gb-GB", "returnUrl":"https://your-company.com/checkout?shopperOrder=12xy.." } ``` If the payment was successfully received the response will contain the `resultCode` **Received** and a `pspReference`, which is our unique identifier for this transaction. You can track whether the payment was successful using webhooks. ## Test and go live Before accepting live BACS Direct Debit payments, test your integration using the following details: | Account Name | Account Number | Sort Code | | ------------ | -------------- | --------- | | David Archer | 09083055 | 560036 | Check the status of BACS Direct Debit test payments in your [Customer Area](https://ca-test.adyen.com/) > **Transactions** > **Payments**. Before you can accept live BACS Direct Debit payments, you need to [submit a request for BACS Direct Debit](/payment-methods/add-payment-methods) in your [live Customer Area](https://ca-live.adyen.com/). ## Advanced flow Component ## Requirements | Requirement | Description | | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - | | **Integration type** | Make sure that you have an existing Advanced flow [Android Components integration](/online-payments/build-your-integration/advanced-flow?platform=Android\&integration=Components). | | | **Action handling** | Make sure that your existing integration is set up to [handle the additional action](/online-payments/build-your-integration/advanced-flow/?platform=Android\&integration=Components#additional-action). `action.type`: Direct. | | | **Setup steps** | Before you begin, [add BACS Direct Debit in your Customer Area](/payment-methods/add-payment-methods). | | ### Import ## Import the Component for BACS Direct Debit To [import the library](/online-payments/build-your-integration/advanced-flow/?platform=Android\&integration=Components#import) and include the module for BACS Direct Debit. ### Tab: With Jetpack Compose **Import the module with Compose** ```java implementation "com.adyen.checkout:bacs:YOUR_VERSION" implementation "com.adyen.checkout:components-compose:YOUR_VERSION" ``` ### Tab: Without Jetpack Compose **Import the module without Compose** ```java implementation "com.adyen.checkout:bacs:YOUR_VERSION" ``` ### Add Configuration ## Add additional configuration for BACS Direct Debit [Add a configuration object](/online-payments/build-your-integration/advanced-flow/?platform=Android\&integration=Components#3-optional-add-a-configuration-object) with the following parameters: | Parameter | Required | Description | | ---------------------- | -------- | -------------------------------------------------------------------- | | setSubmitButtonVisible | | Set to **false** to hide the submit button. The default is **true**. | **Add a configuration object** ```kotlin CheckoutConfiguration( ... ) { bacs { setSubmitButtonVisible(value) } } ``` ### Launch And Show ## Launch and show the Component for BACS Direct Debit To [create the Component](/online-payments/build-your-integration/advanced-flow/?platform=Android\&integration=Components#launch-and-show) for BACS Direct Debit, use the `BacsDirectDebitComponent` class. ### Tab: With Jetpack Compose **Launch and show the Component** ```kotlin import com.adyen.checkout.components.compose.get // Create the payment method object from the /paymentMethods response. val paymentMethod = paymentMethodsApiResponse?.paymentMethods.orEmpty().firstOrNull { it.type == PaymentMethodTypes.BACS } @Composable private fun ComposableBacsDirectDebitComponent() { // Keep a reference to this Component in case you need to access it later. val bacsComponent = BacsDirectDebitComponent.PROVIDER.get( paymentMethod = paymentMethod, configuration = checkoutConfiguration, componentCallback = callback, // This key is required to ensure a new Component gets created for each different screen or payment session. // Generate a new value for this key every time you need to reset the Component. key = "UNIQUE_KEY_PER_COMPONENT", ) // This is your composable, a wrapper around our xml view. AdyenComponent( component = bacsComponent, modifier = YOUR_MODIFIER, ) } ``` ### Tab: Without Jetpack Compose ```kotlin // Create the payment method object from the /paymentMethods response. val paymentMethod = paymentMethodsApiResponse?.paymentMethods.orEmpty().firstOrNull { it.type == PaymentMethodTypes.BACS } val bacsComponent = BacsDirectDebitComponent.PROVIDER.get( activity, // Your activity or fragment. paymentMethod, checkoutConfiguration, componentCallback, ) //Attach the Component to your view. binding.bacsView.attach(bacsComponent, activity) // Your activity or fragment. ``` ### Add Parameters Payments Request ## Add additional parameters to your /payments request When you [make a payment](/online-payments/build-your-integration/advanced-flow/?platform=Android\&integration=Components#make-a-payment), add the following parameters to the [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request: | Parameter | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ---------------------------------------------- | | [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 email of the shopper. | | [paymentMethod.type](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-paymentMethod-BacsDirectDebitDetails-type) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Set to **directdebit\_GB**. | | [paymentMethod.holderName](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-paymentMethod-BacsDirectDebitDetails-holderName) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The bank account holder's name. | | [paymentMethod.bankAccountNumber](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-paymentMethod-BacsDirectDebitDetails-bankAccountNumber) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The bank account holder's bank account number. | | [paymentMethod.bankLocationId](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-paymentMethod-BacsDirectDebitDetails-bankLocationId) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The bank routing number of the account. | **Example payment request for BACS Direct Debit** #### 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 '{ "amount":{ "currency":"GBP", "value":1000 }, "reference":"YOUR_ORDER_NUMBER", "returnUrl":"https://your-company.com/checkout?shopperOrder=12xy..", "merchantAccount":"ADYEN_MERCHANT_ACCOUNT", "paymentMethod":{ "type":"directdebit_GB", "holderName":"S. Hopper", "bankAccountNumber":"09083055", "bankLocationId":"560036" }, "countryCode": "GB", "shopperEmail":"s.hopper@gmail.com" }' ``` #### Java ```java // Adyen Java API Library v41.0.0 import com.adyen.Client; import com.adyen.enums.Environment; import com.adyen.model.checkout.*; import java.time.OffsetDateTime; import java.util.*; import com.adyen.model.RequestOptions; import com.adyen.service.checkout.*; // For the LIVE environment, also include your liveEndpointUrlPrefix. Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Create the request object(s) Amount amount = new Amount() .currency("GBP") .value(1000L); BacsDirectDebitDetails bacsDirectDebitDetails = new BacsDirectDebitDetails() .holderName("S. Hopper") .bankAccountNumber("09083055") .type(BacsDirectDebitDetails.TypeEnum.DIRECTDEBIT_GB) .bankLocationId("560036"); PaymentRequest paymentRequest = new PaymentRequest() .reference("YOUR_ORDER_NUMBER") .amount(amount) .merchantAccount("ADYEN_MERCHANT_ACCOUNT") .countryCode("GB") .paymentMethod(new CheckoutPaymentMethod(bacsDirectDebitDetails)) .shopperEmail("s.hopper@gmail.com") .returnUrl("https://your-company.com/checkout?shopperOrder=12xy.."); // 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); $checkoutPaymentMethod = new CheckoutPaymentMethod(); $checkoutPaymentMethod ->setHolderName("S. Hopper") ->setBankAccountNumber("09083055") ->setType("directdebit_GB") ->setBankLocationId("560036"); $paymentRequest = new PaymentRequest(); $paymentRequest ->setReference("YOUR_ORDER_NUMBER") ->setAmount($amount) ->setMerchantAccount("ADYEN_MERCHANT_ACCOUNT") ->setCountryCode("GB") ->setPaymentMethod($checkoutPaymentMethod) ->setShopperEmail("s.hopper@gmail.com") ->setReturnUrl("https://your-company.com/checkout?shopperOrder=12xy.."); $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new PaymentsApi($client); $response = $service->payments($paymentRequest, $requestOptions); ``` #### C\# ```cs // Adyen .NET API Library v34.0.0 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.Checkout; using Adyen.Service.Checkout; // For the LIVE environment, also include your liveEndpointUrlPrefix. var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Create the request object(s) Amount amount = new Amount { Currency = "GBP", Value = 1000 }; BacsDirectDebitDetails bacsDirectDebitDetails = new BacsDirectDebitDetails { HolderName = "S. Hopper", BankAccountNumber = "09083055", Type = BacsDirectDebitDetails.TypeEnum.DirectdebitGB, BankLocationId = "560036" }; PaymentRequest paymentRequest = new PaymentRequest { Reference = "YOUR_ORDER_NUMBER", Amount = amount, MerchantAccount = "ADYEN_MERCHANT_ACCOUNT", CountryCode = "GB", PaymentMethod = new CheckoutPaymentMethod(bacsDirectDebitDetails), ShopperEmail = "s.hopper@gmail.com", ReturnUrl = "https://your-company.com/checkout?shopperOrder=12xy.." }; // Send the request var service = new PaymentsService(client); var response = service.Payments(paymentRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"}); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v30.1.0 const { Client, 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 = { amount: { currency: "GBP", value: 1000 }, reference: "YOUR_ORDER_NUMBER", returnUrl: "https://your-company.com/checkout?shopperOrder=12xy..", merchantAccount: "ADYEN_MERCHANT_ACCOUNT", paymentMethod: { type: "directdebit_GB", holderName: "S. Hopper", bankAccountNumber: "09083055", bankLocationId: "560036" }, countryCode: "GB", shopperEmail: "s.hopper@gmail.com" } // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` #### Go ```go // Adyen Go API Library v21.2.0 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, } bacsDirectDebitDetails := checkout.BacsDirectDebitDetails{ HolderName: common.PtrString("S. Hopper"), BankAccountNumber: common.PtrString("09083055"), Type: common.PtrString("directdebit_GB"), BankLocationId: common.PtrString("560036"), } paymentRequest := checkout.PaymentRequest{ Reference: "YOUR_ORDER_NUMBER", Amount: amount, MerchantAccount: "ADYEN_MERCHANT_ACCOUNT", CountryCode: common.PtrString("GB"), PaymentMethod: checkout.BacsDirectDebitDetailsAsCheckoutPaymentMethod(&bacsDirectDebitDetails), ShopperEmail: common.PtrString("s.hopper@gmail.com"), ReturnUrl: "https://your-company.com/checkout?shopperOrder=12xy..", } // 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 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": { "currency": "GBP", "value": 1000 }, "reference": "YOUR_ORDER_NUMBER", "returnUrl": "https://your-company.com/checkout?shopperOrder=12xy..", "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "paymentMethod": { "type": "directdebit_GB", "holderName": "S. Hopper", "bankAccountNumber": "09083055", "bankLocationId": "560036" }, "countryCode": "GB", "shopperEmail": "s.hopper@gmail.com" } # Send the request result = adyen.checkout.payments_api.payments(request=json_request, idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v11.2.0 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 => { :currency => 'GBP', :value => 1000 }, :reference => 'YOUR_ORDER_NUMBER', :returnUrl => 'https://your-company.com/checkout?shopperOrder=12xy..', :merchantAccount => 'ADYEN_MERCHANT_ACCOUNT', :paymentMethod => { :type => 'directdebit_GB', :holderName => 'S. Hopper', :bankAccountNumber => '09083055', :bankLocationId => '560036' }, :countryCode => 'GB', :shopperEmail => 's.hopper@gmail.com' } # Send the request result = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' => 'UUID' }) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v30.1.0 import { Client, 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 bacsDirectDebitDetails: Types.checkout.BacsDirectDebitDetails = { holderName: "S. Hopper", bankAccountNumber: "09083055", type: Types.checkout.BacsDirectDebitDetails.TypeEnum.DirectdebitGb, bankLocationId: "560036" }; const paymentRequest: Types.checkout.PaymentRequest = { reference: "YOUR_ORDER_NUMBER", amount: amount, merchantAccount: "ADYEN_MERCHANT_ACCOUNT", countryCode: "GB", paymentMethod: bacsDirectDebitDetails, shopperEmail: "s.hopper@gmail.com", returnUrl: "https://your-company.com/checkout?shopperOrder=12xy.." }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` The response includes the `action.type`: Direct. **Example response for a successful payment** ```json { "resultCode": "Received", "action": { "type": "voucher", "paymentMethodType": "directdebit_GB", "url": "PDF_MANDATE_URL" } } ``` ### Recurring ## Recurring payments If you have a recurring or subscription business model, we recommend tokenizing the shopper's payment details. When you create a shopper token from a BACS Direct Debit payment, we store the shopper's payment details with the token. You can use this token to make recurring BACS Direct Debit payments. You need to use the [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) endpoint to [make recurring payments with the token](#make-recurring-payments). We strongly recommend that you request explicit permission from the shopper if you intend to make recurring BACS Direct Debit payments. Being transparent about the payment schedule and the amount they will be charged will reduce the risk of [chargebacks](/get-started-with-adyen/adyen-glossary/#chargeback). Under the [Direct Debit Guarantee](https://www.directdebit.co.uk/direct-debit-explained/direct-debit-guarantee), if there is a change in the collection date or the amount, you must give the shopper advance notice of the payment. ### Create shopper token [Tokenize the shopper's payment details](/online-payments/tokenization/make-token-payments) when you make the initial BACS Direct Debit payment. 1. When you make a POST request to [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) to make a payment, additionally include: * `shopperReference`: Your unique ID for this shopper. * `storePaymentMethod`: **true**. 2. When you receive the [recurring.token.created](https://docs.adyen.com/api-explorer/Tokenization-webhooks/latest/post/recurring.token.created), store the `storedPaymentMethodId`. This is the token you will need to make recurring payments for this shopper. ### Make recurring payments We strongly recommend giving shoppers advance notice before each payment. For each recurring payment for this shopper, make a BACS Direct Debit payment with a POST request to the [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) endpoint, and additionally include: * `paymentMethod.recurringDetailReference` or `paymentMethod.storedPaymentMethodId`for API v49 and above. This is the `storedPaymentMethodId` returned in the [recurring.token.created](https://docs.adyen.com/api-explorer/Tokenization-webhooks/latest/post/recurring.token.created) webhook when you created the token. * `shopperReference`: the unique shopper ID you used to create the shopper token. * `shopperInteraction`: **ContAuth**. ```json { "merchantAccount":"YOUR_MERCHANT_ACCOUNT", "reference":"BACS test payment", "shopperReference":"YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j", "shopperInteraction":"ContAuth", "amount":{ "currency":"GBP", "value":49900 }, "paymentMethod":{ "type":"directdebit_GB", "storedPaymentMethodId":"7219687191761347" }, "countryCode":"GB", "shopperLocale":"gb-GB", "returnUrl":"https://your-company.com/checkout?shopperOrder=12xy.." } ``` If the payment was successfully received the response will contain the `resultCode` **Received** and a `pspReference`, which is our unique identifier for this transaction. You can track whether the payment was successful using webhooks. ## Test and go live Before accepting live BACS Direct Debit payments, test your integration using the following details: | Account Name | Account Number | Sort Code | | ------------ | -------------- | --------- | | David Archer | 09083055 | 560036 | Check the status of BACS Direct Debit test payments in your [Customer Area](https://ca-test.adyen.com/) > **Transactions** > **Payments**. Before you can accept live BACS Direct Debit payments, you need to [submit a request for BACS Direct Debit](/payment-methods/add-payment-methods) in your [live Customer Area](https://ca-live.adyen.com/).