--- title: "Touch'n Go Android Component" description: "Add Touch'n Go to an existing Components integration." url: "https://docs.adyen.com/payment-methods/touchngo/android-component" source_url: "https://docs.adyen.com/payment-methods/touchngo/android-component.md" canonical: "https://docs.adyen.com/payment-methods/touchngo/android-component" last_modified: "2019-09-06T17:19:00+02:00" language: "en" --- # Touch'n Go Android Component Add Touch'n Go to an existing Components integration. [View source](/payment-methods/touchngo/android-component.md) **If you are using Android Components v5.0.0 or later:** This payment method requires no additional configuration. Follow the [Components integration guide](/online-payments/build-your-integration/sessions-flow?platform=Android\&integration=Components) and use the following module and Component names: * To [import the module](/online-payments/build-your-integration/sessions-flow/?platform=Android\&integration=Components#import): **instant** * To [launch and show the Component](/online-payments/build-your-integration/sessions-flow?platform=Android\&integration=Components#launch-and-show): **InstantPaymentComponent** If you have an existing [Android Components](/online-payments/build-your-integration/sessions-flow?platform=Android\&integration=Components) integration, you can use our Redirect Component to redirect the shopper to complete the payment. As with other redirect payment methods, you need to [handle the redirect](#handle-the-redirect) after the shopper returns to your app. ## 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\&integration=Components). | | **Setup steps** | Before you begin, contact our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other) to add Touch'n Go in your Customer Area. | ## Show Touch'n Go in your payment form Include Touch'n Go in the list of available payment methods. You do not need to collect any information from the shopper in your payment form. 1. Specify in your [/paymentMethods](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods) request: * [countryCode](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods#request-countryCode): **MY** * [amount.currency](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods#request-amount-currency): **MYR**. * [channel](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods#request-channel): Specify ****. The response contains `paymentMethod.type`: **touchngo**. We provide logos for Touch'n Go which you can use on your payment form. For more information, refer to [Downloading logos](/online-payments/build-your-integration/advanced-flow/?platform=Web\&integration=API%20only#downloading-logos). ## Make a payment From your server, make a [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request, specifying: * `paymentMethod.type`: **touchngo**. * `returnURL`: URL to where the shopper should be redirected back to after they complete the payment. This URL can have a maximum of 1024 characters. Get this URL from the Component in the `RedirectComponent.getReturnUrl(context)`. #### curl ```bash curl https://checkout-test.adyen.com/v68/payments \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "merchantAccount":"ADYEN_MERCHANT_ACCOUNT", "reference":"YOUR_ORDER_NUMBER", "amount":{ "currency":"MYR", "value":1000 }, "paymentMethod":{ "type":"touchngo" }, "returnUrl":"adyencheckout://your.package.name" }' ``` #### Java ```java // Adyen Java API Library v27.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, additionally include your liveEndpointUrlPrefix. Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Create the request object(s) Amount amount = new Amount() .currency("MYR") .value(1000L); PaymentDetails paymentDetails = new PaymentDetails() .type(PaymentDetails.TypeEnum.TOUCHNGO); PaymentRequest paymentRequest = new PaymentRequest() .reference("YOUR_ORDER_NUMBER") .amount(amount) .merchantAccount("ADYEN_MERCHANT_ACCOUNT") .paymentMethod(new CheckoutPaymentMethod(paymentDetails)) .returnUrl("adyencheckout://your.package.name"); // Send the request PaymentsApi service = new PaymentsApi(client); PaymentResponse response = service.payments(paymentRequest, new RequestOptions().idempotencyKey("UUID")); ``` #### PHP ```php // Adyen PHP API Library v19.0.0 use Adyen\Client; use Adyen\Environment; use Adyen\Model\Checkout\Amount; use Adyen\Model\Checkout\CheckoutPaymentMethod; use Adyen\Model\Checkout\PaymentRequest; use Adyen\Service\Checkout\PaymentsApi; $client = new Client(); $client->setXApiKey("ADYEN_API_KEY"); // For the live environment, additionally include your liveEndpointUrlPrefix. $client->setEnvironment(Environment::TEST); // Create the request object(s) $amount = new Amount(); $amount ->setCurrency("MYR") ->setValue(1000); $checkoutPaymentMethod = new CheckoutPaymentMethod(); $checkoutPaymentMethod ->setType("touchngo"); $paymentRequest = new PaymentRequest(); $paymentRequest ->setReference("YOUR_ORDER_NUMBER") ->setAmount($amount) ->setMerchantAccount("ADYEN_MERCHANT_ACCOUNT") ->setPaymentMethod($checkoutPaymentMethod) ->setReturnUrl("adyencheckout://your.package.name"); $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new PaymentsApi($client); $response = $service->payments($paymentRequest, $requestOptions); ``` #### C\# ```cs // Adyen .net API Library v17.0.0 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.Checkout; using Adyen.Service.Checkout; // For the live environment, additionally 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 = "MYR", Value = 1000 }; PaymentDetails paymentDetails = new PaymentDetails { Type = PaymentDetails.TypeEnum.Touchngo }; PaymentRequest paymentRequest = new PaymentRequest { Reference = "YOUR_ORDER_NUMBER", Amount = amount, MerchantAccount = "ADYEN_MERCHANT_ACCOUNT", PaymentMethod = new CheckoutPaymentMethod(paymentDetails), ReturnUrl = "adyencheckout://your.package.name" }; // 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 v18.0.0 // Require the parts of the module you want to use const { Client, CheckoutAPI } = require('@adyen/api-library'); // Initialize the client object // For the live environment, additionally include your liveEndpointUrlPrefix. const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object(s) const paymentRequest = { merchantAccount: "ADYEN_MERCHANT_ACCOUNT", reference: "YOUR_ORDER_NUMBER", amount: { currency: "MYR", value: 1000 }, paymentMethod: { type: "touchngo" }, returnUrl: "adyencheckout://your.package.name" } // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` #### Go ```go // Adyen Go API Library v10.4.0 import ( "context" "github.com/adyen/adyen-go-api-library/v9/src/common" "github.com/adyen/adyen-go-api-library/v9/src/adyen" "github.com/adyen/adyen-go-api-library/v9/src/checkout" ) // For the live environment, additionally include your liveEndpointUrlPrefix. client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Create the request object(s) amount := checkout.Amount{ Currency: "MYR", Value: 1000, } paymentDetails := checkout.PaymentDetails{ Type: common.PtrString("touchngo"), } paymentRequest := checkout.PaymentRequest{ Reference: "YOUR_ORDER_NUMBER", Amount: amount, MerchantAccount: "ADYEN_MERCHANT_ACCOUNT", PaymentMethod: checkout.PaymentDetailsAsCheckoutPaymentMethod(&paymentDetails), ReturnUrl: "adyencheckout://your.package.name", } // 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 v12.5.1 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" # For the live environment, additionally 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_ORDER_NUMBER", "amount": { "currency": "MYR", "value": 1000 }, "paymentMethod": { "type": "touchngo" }, "returnUrl": "adyencheckout://your.package.name" } # Send the request result = adyen.checkout.payments_api.payments(request=json_request, idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v9.5.1 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' # For the live environment, additionally 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_ORDER_NUMBER', :amount => { :currency => 'MYR', :value => 1000 }, :paymentMethod => { :type => 'touchngo' }, :returnUrl => 'adyencheckout://your.package.name' } # Send the request result = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' => 'UUID' }) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v18.0.0 // Require the parts of the module you want to use import { Client, CheckoutAPI, Types } from "@adyen/api-library"; // Initialize the client object // For the live environment, additionally include your liveEndpointUrlPrefix. const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object(s) const amount: Types.checkout.Amount = { currency: "MYR", value: 1000 }; const paymentDetails: Types.checkout.PaymentDetails = { type: Types.checkout.PaymentDetails.TypeEnum.Touchngo }; const paymentRequest: Types.checkout.PaymentRequest = { reference: "YOUR_ORDER_NUMBER", amount: amount, merchantAccount: "ADYEN_MERCHANT_ACCOUNT", paymentMethod: paymentDetails, returnUrl: "adyencheckout://your.package.name" }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` In the [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) response, check the `action` object for the information that you must use to redirect the shopper. **/payments response** ```json { "resultCode":"RedirectShopper", "action":{ "paymentMethodType":"touchngo", "method":"GET", "url":"https://checkoutshopper-test.adyen.com/checkoutshopper/checkoutPaymentRedirect?redirectData=...", "type":"redirect" } } ``` ## Handle the redirect 1. [Use the Redirect Component](/online-payments/build-your-integration/sessions-flow/?platform=Android\&integration=Components#handle-a-redirect) to redirect the shopper to the Touch'n Go app. 2. After the shopper returns to your app, make a POST [/payments/details](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/details) request from your server, providing: * `details`: The `actionComponentData.details` object from the Redirect Component. **/payments/details request** ```bash curl https://checkout-test.adyen.com/v72/payments/details \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "details": { "redirectResult": "eyJ0cmFuc1N0YXR1cyI6IlkifQ==" } }' ``` You receive a response containing: * `resultCode`: Use this to present the payment result to your shopper. * `pspReference`: Our unique identifier for the transaction. **/payments/details response** ```json { "resultCode": "Authorised", "pspReference": "PPKFQ89R6QRXGN82" } ``` ## Test and go live Check the status of Touch'n Go test payments in your **Customer Area** > **Transactions** > **Payments**. To accept live Touch'n Go payments, you must contact our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other) to add Touch'n Go 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)