Android

You can add the Transak widget to your Android app using the below code.

Make sure to add your API key and customise using query parameters.

MainActivity.Java

import android.webkit.PermissionRequest
import android.webkit.WebChromeClient
...

transakWidgetView.run {
  this.settings.javaScriptEnabled = true
  this.settings.domStorageEnabled = true
  
  this.webChromeClient = object : WebChromeClient() {
      override fun onPermissionRequest(request: PermissionRequest) {
          request.grant(request.resources)
      }
  }
  
  loadUrl("https://global-stg.transak.com?apiKey=<YOUR_API_KEY>&environment=STAGING&productsAvailed=BUY,SELL")
  
}
import android.webkit.PermissionRequest
import android.webkit.WebChromeClient
import android.webkit.WebView
...

AndroidView(
    factory = {
        WebView(it).apply {
          
            this.layoutParams =
                ViewGroup.LayoutParams(
                    ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.MATCH_PARENT
                )
                
            this.settings.javaScriptEnabled = true
            this.settings.domStorageEnabled = true

            this.webChromeClient = object : WebChromeClient() {
                override fun onPermissionRequest(request: PermissionRequest) {
                    request.grant(request.resources)
                }
            }
        }
    },
    update = {
        it.loadUrl(
            "https://global-stg.transak.com?apiKey=<YOUR_API_KEY>&environment=STAGING&productsAvailed=BUY,SELL"
        )
    }
)
import android.webkit.WebView;
...

webView = (WebView) findViewById(R.id.transakWidgetView);

webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setDomStorageEnabled(true);

webView.setWebChromeClient(new WebChromeClient() {
   @Override
   public void onPermissionRequest(PermissionRequest request) {
      super.onPermissionRequest(request);
      request.grant(request.getResources());
   }
});

webView.loadUrl("https://global-stg.transak.com?apiKey=<YOUR_API_KEY>&environment=STAGING&productsAvailed=BUY,SELL");

activity_main.xml

<WebView xmlns:android="<http://schemas.android.com/apk/res/android>"
    android:id="@+id/transakWidgetView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

Provide permissions in AndroidManifest.XML

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CAMERA"/>