---
title: Transactions
slug: LJ8v-transactions
docTags: 
createdAt: 2025-06-03T09:24:12.802Z
---

## Pay3.getInstance().openCheckout(checkout obj)

Pay3 Android SDK expects you to pass token and requestId which you get in response while creating a checkout order with Pay3's create checkout order API

**Parameters**

1. **requestId&#x20;**(Type string): App needs to generate a unique identifier for every checkout call. This id can be used by the App to identify and update state in App's backend. &#x20;
2. **token&#x20;**(Type string):  This is a unique id generated by Pay3 backend on calling create checkout order. This is to identify the request created by Application's backend.

```kotlin
createOrder { response, error ->
    if (response != null) {
        val token = response.token
        val requestId = response.requestId
        
        Pay3.getInstance().openCheckout(
            context = this,
            requestId = requestId,
            token = token,
            onClosed = {
                // Handle payment completion or cancellation
                Log.d("Payment", "Payment flow closed")
            }
        )
    } else {
        // Handle error
        Log.e("Payment", "Failed to create order: $error")
    }
}
```

## Payment Flow

The SDK handles the complete payment flow, including:

1. Displaying available payment methods
2. UPI app selection and deep linking
3. Card and net banking options
4. Payment status tracking
5. Success/failure handling

### Example Implementatation:

:::CodeblockTabs
PaymentActivity.kt

```kotlin
import com.pay3.sdk.Pay3

class PaymentActivity : ComponentActivity() {
    private val TAG = "PaymentActivity"
    
    fun processPayment(productId: String, amount: Double) {
    // Create order with your backend with Pay3's creat checkout order API
        val orderRequest = OrderRequest(productId, amount)
        
        createOrder(orderRequest) { response, error ->
            if (response != null) {
                // Start payment flow
                Pay3.getInstance().openCheckout( // call to Pay3 Android SDK
                    context = this,
                    requestId = response.requestId,
                    token = response.token,
                    onClosed = {
                        // Payment completed or cancelled
                        // Verify payment status with your backend
                        verifyPaymentStatus(response.requestId)
                    }   
                )
            } else {
                Log.e(TAG, "Failed to create order: $error")
                showError("Unable to process payment. Please try again.")
            }
        }
    }
    
    private fun verifyPaymentStatus(requestId: String) {
        // Check payment status with your backend
    }
}
```
:::

***

