# Quickstart > Before reading this document, ensure you have completed the [Integration Guide](/payments/docs/introduction/integrated-guide) and are familiar with the [APIs for creating a checkout](/payments/apis/introduction/started). The Android SDK provided by PayKKa allows you to easily embed our [Web Checkout](/payments/docs/transaction/web/hosted-web) via a WebView. By simply providing a `sessionId` to the SDK, you can open the checkout page within your app, accept payments, and customize payment callbacks. The latest SDK download link is available in the [Android SDK Release History](/payments/docs/developer-resources/native-sdks/android-sdk/release-history). ## Step 1: Integrate the SDK into Your Project After downloading the SDK, you will receive a .zip file with the following directory structure: ```txt . ├── libs │   └── paykka-checkout-payments-1.0-alpha-Release.aar └── PayKKaCheckoutApp-Android ├── JavaCheckoutDemo │   ├── app │   ├── build.gradle │   ├── gradle │   ├── gradle.properties │   ├── gradlew │   ├── gradlew.bat │   └── settings.gradle └── KotlinCheckoutDemo ├── app ├── build.gradle.kts ├── gradle ├── gradle.properties ├── gradlew ├── gradlew.bat └── settings.gradle.kts ``` The `PayKKaCheckoutApp-Android` folder contains sample Android projects in Java and Kotlin, allowing developers to understand how to use the PayKKa SDK APIs through sample code. The `.aar` file in the `libs` folder is the core PayKKa SDK. Copy the `libs` folder from the zip file into your Android project's `app/` directory (e.g., `YourAppProject/app/`). Then, edit your `app/build.gradle.kts` or `app/build.gradle` file and add the following code to integrate and use the SDK: Kotlin ```kotlin app/build.gradle.kts plugins { ... } android { ... } dependencies { ... // Required, for JSON serialization/deserialization implementation("com.alibaba:fastjson:1.2.83") // Required, the SDK uses WebKit features implementation("androidx.webkit:webkit:1.14.0") // Required, includes all libraries and dependencies in the libs directory implementation( fileTree( mapOf( "dir" to "libs", "include" to listOf("*.aar", "*.jar") ) ) ) } ``` Java ```gradle app/build.gradle plugins { ... } android { ... } dependencies { // Required, includes all libraries and dependencies in the libs directory implementation fileTree(dir: 'libs', include: ['*.aar', ['*.jar'], exclude: []) // Required, the SDK uses WebKit features, or: // implementation 'androidx.webkit:webkit:1.14.0' implementation libs.webkit // Required, for JSON serialization/deserialization implementation 'com.alibaba:fastjson:1.2.83' } ``` ## Step 2: Use the SDK in Your Project Once the SDK is integrated, you can start using the PayKKa Checkout in your app. Key code snippets are provided below showing how to customize callbacks and launch the checkout to guide users through the payment process. Kotlin ```kotlin ConfirmOrderActivity.kt import ... class ConfirmOrderActivity : ComponentActivity() { val TAG = "ConfirmOrderActivity" private lateinit var paykkaLauncher: PayKKaActivityResultLauncher; override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // Ensure registerForActivityResult is called before Activity onCreate paykkaLauncher = PayKKa.registerForActivityResult(this) {paymentResult -> // Write your payment callback logic here val intent = Intent(this, PaymentCompleteActivity::class.java) intent.putExtra("paymentResult", paymentResult.toString()) startActivity(intent) finish() } setContent { KotlinCheckoutDemoTheme { ConfirmOrderScreen { goPay() } } } } private fun goPay() { // Switch PayKKa environment PayKKa.useEnv(PayKKaEnv.SANDBOX) // Tapping the "Confirm Payment" button launches the checkout (the sessionId is typically returned by your app's backend API) paykkaLauncher.goPay("CSXXXXXXXXXXXXXXXXXX") } override fun onActivityResult( requestCode: Int, resultCode: Int, data: Intent? ) { super.onActivityResult(requestCode, resultCode, data) } } ``` ```kotlin PaymentCompleteScreen.kt import ... @Composable fun PaymentCompleteScreen( paymentResult: PaymentResult ) { val (imageRes, text) = when (paymentResult.status) { // Checkout payment successful PaymentResult.Status.SUCCESS -> R.drawable.icon_check_circle_24px to "Pay Success" // Checkout session expired PaymentResult.Status.EXPIRED -> R.drawable.icon_warning_24px to "The checkout session has expired. Please initiate the payment again." PaymentResult.Status.ERROR -> R.drawable.icon_cancel_24px to "Failed, please try again later" else -> R.drawable.icon_warning_24px to "Unknown Payment status" } Scaffold { _ -> Column( modifier = Modifier .fillMaxSize() .padding(24.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center ) { Image( painter = painterResource(id = imageRes), contentDescription = null, modifier = Modifier .size(110.dp), contentScale = ContentScale.Fit ) Spacer( modifier = Modifier.height(100.dp) ) text( text = text, fontSize = 16.sp, color = MaterialTheme.colorScheme.onBackground, textAlign = TextAlign.Center ) } } } ``` ```kotlin PaymentCompleteActivity.kt import ... // App payment result display screen class PaymentCompleteActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) val statusString = intent.getStringExtra("paymentResult") val paymentResult = PaymentResult.fromString(statusString) setContent { KotlinCheckoutDemoTheme { PaymentCompleteScreen(paymentResult = paymentResult) } } } } ``` Java ```java ConfirmOrderActivity.java ... public class ConfirmOrderActivity extends AppCompatActivity { Button btnPay; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_confirm_order); Activity context = this; // Switch PayKKa checkout environment PayKKa.useEnv(PayKKaEnv.SANDBOX); btnPay = findViewById(R.id.btn_pay); btnPay.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // Tapping the "Confirm Payment" button launches the checkout (the sessionId is typically returned by your app's backend API) PayKKa.goPay(context, "CSXXXXXXXXXXXXXXXXXX", (paymentResult) -> { // Write your payment callback logic here Intent intent = new Intent(context, PaymentComplete.class); intent.putExtra("paymentResult", paymentResult.toString()); startActivity(intent); context.finish(); }); } }); } @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { super.onActivityResult(requestCode, resultCode, data); // Note: Ensure PayKKa.onPaymentResult is called in onActivityResult to trigger your predefined payment callback logic PayKKa.onPaymentResult(requestCode, resultCode, data); } } ``` ```java PaymentComplete.java ... // App payment result display screen public class PaymentComplete extends AppCompatActivity { ImageView statusImage; TextView statusText; PaymentResult paymentResult; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_payment_complete); statusImage = findViewById(R.id.statusImage); statusText = findViewById(R.id.statusText); String status = getIntent().getStringExtra("paymentResult"); paymentResult = PaymentResult.fromString(status); updateUI(paymentResult); } private void updateUI(PaymentResult paymentResult) { int imgResourceId = R.drawable.icon_warning_24px; String text = "Unknown Payment status"; switch (paymentResult.getStatus()) { // Checkout payment successful case SUCCESS: imgResourceId = R.drawable.icon_check_circle_24px; text = "Pay Success"; break; // Checkout session expired case EXPIRED: imgResourceId = R.drawable.icon_warning_24px; text = "The checkout session has expired. Please initiate the payment again."; break; case ERROR: imgResourceId = R.drawable.icon_cancel_24px; text = "Failed, please try again later"; break; } statusImage.setImageResource(imgResourceId); statusText.setText(text); } } ``` ## Step 3: Test the Payment You can use test cards in the PayKKa SANDBOX environment for testing. Switch to the PROD environment when building the release version of your app. Kotlin ```kotlin /// SANDBOX (default) PayKKa.useEnv(PayKKaEnv.SANDBOX) /// Switch to European production environment PayKKa.useEnv(PayKKaEnv.PROD_EU) /// Switch to Hong Kong production environment PayKKa.useEnv(PayKKaEnv.PROD_HK) ``` Java ```java /// SANDBOX (default) PayKKa.useEnv(PayKKaEnv.SANDBOX); /// Switch to European production environment PayKKa.useEnv(PayKKaEnv.PROD_EU); /// Switch to Hong Kong production environment PayKKa.useEnv(PayKKaEnv.PROD_HK); ``` ## Precautions ### Google Pay #### 1. How to use test cards for payment testing? Please refer to: [Payment Method - Google Pay](/payments/docs/payment-method/google-pay/google-pay#test-google-pay). #### 2. Google Pay unable to receive payments in PROD environment, error "OR_BIBED_11" Google Pay uses test environments and mock data during testing, but processes real user payment card information once live. To protect user and merchant funds and privacy, Google requires: - A supported **payment gateway** (e.g., PayKKa) or - A PCI DSS-compliant (Payment Card Industry Data Security Standard) environment to apply for production access. This ensures you can safely handle sensitive payment information beyond development and test modes. Therefore, you must also complete the [Google Pay - Publish your integration](https://developers.google.com/pay/api/android/guides/test-and-deploy/publish-your-integration) steps.