--- title: "DuitNow Android Component" description: "Add DuitNow to an existing Components integration." url: "https://docs.adyen.com/payment-methods/duitnow/android-component" source_url: "https://docs.adyen.com/payment-methods/duitnow/android-component.md" canonical: "https://docs.adyen.com/payment-methods/duitnow/android-component" last_modified: "2019-09-06T17:19:00+02:00" language: "en" --- # DuitNow Android Component Add DuitNow to an existing Components integration. [View source](/payment-methods/duitnow/android-component.md) This page explains how to add DuitNow to your existing Android Components integration. Choose the [server-side flow](/online-payments/build-your-integration) that your integration uses: ### Tab: Sessions flow ## Requirements | Requirement | Description | | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Integration type** | Make sure that you have built a Sessions flow [Android Components integration](/online-payments/build-your-integration/sessions-flow?platform=Android). The minimum required version is 5.0.0. | | **Setup steps** | Before you begin, contact our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other) to add DuitNow in your Customer Area. | ## Create a payment session This step corresponds to [Create a payment session](/online-payments/build-your-integration/sessions-flow/?platform=Android\&integration=Components\&version=5.3.0#create-the-checkout-session) in the Components integration guide. You do not need to include any additional parameters for DuitNow in the API request. ## Set up Components This section corresponds to [Set up Components](/online-payments/build-your-integration/sessions-flow/?platform=Android\&integration=Components#set-up) in the Components integration guide. ### Import the library This step corresponds to the [Import the library step](/online-payments/build-your-integration/sessions-flow/?platform=Android\&integration=Components#import) of the Components integration guide. During this step of integrating, use the following code snippets: #### With Jetpack Compose **Import the library with Compose** ```java implementation "com.adyen.checkout:instant:YOUR_VERSION" implementation "com.adyen.checkout:components-compose:YOUR_VERSION" ``` #### Without Jetpack Compose **Import the library without Compose** ```java implementation "com.adyen.checkout:instant:YOUR_VERSION" ``` ### Configure the Component This step corresponds to [Configure components](/online-payments/build-your-integration/sessions-flow/?platform=Android\&integration=Components#import) of the Components integration guide. You do not need to add specific configuration for DuitNow. ### Create the checkout session This step corresponds to the [create a payment session step](/online-payments/build-your-integration/sessions-flow/?platform=Android\&integration=Components\&version=5.3.0#create-the-checkout-session) in the main integration guide. ### Launch and show the Component This corresponds to the [Launch and show the Component step](/online-payments/build-your-integration/sessions-flow/?platform=Android\&integration=Components#launch-and-show) in the main integration guide. During this step of integrating, use the following code snippets: #### With Jetpack Compose **Launch the Component with Compose** ```java Component import com.adyen.checkout.components.compose.get // Get the payment method. val paymentMethod = checkoutSession.getPaymentMethod(PaymentMethodTypes.DUITNOW) @Composable private fun ComposableInstantComponent() { // Keep a reference to this Component in case you need to access it later. val instantPaymentComponent = InstantPaymentComponent.PROVIDER.get( checkoutSession = checkoutSession, paymentMethod = paymentMethod, configuration = configuration, 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 = instantPaymentComponent, modifier = YOUR_MODIFIER, ) ``` #### Without Jetpack Compose **Launch the Component without Compose** ```java // Get the payment method. val paymentMethod = checkoutSession.getPaymentMethod(PaymentMethodTypes.DUITNOW) val instantPaymentComponent = InstantPaymentComponent.PROVIDER.get( activity, // Your activity or fragment. checkoutSession, paymentMethod, cardConfiguration, componentCallback, ) binding.componentView.attach(instantPaymentComponent, viewLifecycleOwner) ``` ### Tab: Advanced flow ## Requirements | Requirement | Description | | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Integration type** | Make sure that you have built an Advanced flow [Android Components integration](/online-payments/build-your-integration/advanced-flow?platform=Android). | | **Setup steps** | Before you begin, contact our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other) to add DuitNow in your Customer Area. | ## Configure Components This corresponds to the [Configure components step](/online-payments/build-your-integration/advanced-flow?platform=Android\&integration=Components\&version=5.2.0#configure) in the main integration guide. You do not need to add specific configuration for DuitNow. ### Import the library This step corresponds to the [Import the library step](/online-payments/build-your-integration/sessions-flow/?platform=Android\&integration=Components#import) of the Components integration guide. During this step of integrating, use the following code snippets: #### With Jetpack Compose **Import the library with Compose** ```java implementation "com.adyen.checkout:instant:YOUR_VERSION" implementation "com.adyen.checkout:components-compose:YOUR_VERSION" ``` #### Without Jetpack Compose **Import the library without Compose** ```java implementation "com.adyen.checkout:instant:YOUR_VERSION" ``` ## Launch and show the Component Follow the steps in the [Android Components Advanced flow integration guide](/online-payments/build-your-integration/advanced-flow/?tab=compose-launch_1#launch-and-show) to launch and show the Component for DuitNow. ## Make a payment Make a payment request with the payment information for the shopper, as described in the [Android Components Advanced flow integration guide](/online-payments/build-your-integration/advanced-flow/?platform=Android\&integration=Components\&version=5.2.0#make-a-payment). **/payments request** #### curl ```bash curl https://checkout-test.adyen.com/v72/payments \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "amount": { "currency": "MYR", "value": 10000 }, "paymentMethod": { "type": "duitnow" }, "reference": "YOUR_ORDER_NUMBER" }' ``` #### Java ```java // Adyen Java API Library v39.3.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) // 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) $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new PaymentsApi($client); $response = $service->payments($paymentRequest, $requestOptions); ``` #### C\# ```cs // Adyen .net API Library v32.1.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) // 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 v29.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 paymentRequest = { merchantAccount: "YOUR_MERCHANT_ACCOUNT", amount: { currency: "MYR", value: 10000 }, paymentMethod: { type: "duitnow" }, reference: "YOUR_ORDER_NUMBER" } // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` #### Go ```go // Adyen Go API Library v21.0.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) // 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 v13.6.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": "YOUR_MERCHANT_ACCOUNT", "amount": { "currency": "MYR", "value": 10000 }, "paymentMethod": { "type": "duitnow" }, "reference": "YOUR_ORDER_NUMBER" } # Send the request result = adyen.checkout.payments_api.payments(request=json_request, idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v10.4.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 => 'YOUR_MERCHANT_ACCOUNT', :amount => { :currency => 'MYR', :value => 10000 }, :paymentMethod => { :type => 'duitnow' }, :reference => 'YOUR_ORDER_NUMBER' } # Send the request result = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' => 'UUID' }) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v29.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) // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` ## Test and go live Test DuitNow payments with real payment details and small amounts. Check the status of your test DuitNow payments in your **Customer Area** > **Transactions** > **Payments**. To accept live DuitNow payments, you must contact our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other) to add DuitNow in your live Customer Area. ## See also * [Android Components integration guide](/online-payments/build-your-integration/sessions-flow?platform=Android\&integration=Components) * [Webhooks](/development-resources/webhooks) * [API Explorer](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/overview)