Pay3 Android SDK
Transactions
4min
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 requestid (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 token (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 createorder { response, error > if (response != null) { val token = response token val requestid = response requestid pay3 getinstance() opencheckout( context = this, requestid = requestid, token = token, onpaymentclosed = { // 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 displaying available payment methods upi app selection and deep linking card and net banking options payment status tracking success/failure handling example implementatation paymentactivity kt 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, onpaymentclosed = { // 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 } }