so I'm implementing this simple razor payment integration. but it's giving me a "No appropriate payment method found" error. I tried choosing the payment options form before that didn't work either.
val razorpay = RazorpayClient("my key", "my secret key")
val orderRequest = JSONObject()
orderRequest.put("amount", 50000); // amount in the smallest currency unit
orderRequest.put("currency", "INR");
orderRequest.put("receipt", "order_rcptid_11")
try {
val order: Order = razorpay.Orders.create(orderRequest)
Timber.d("order : $order")
startPayment(order)
} catch (e: RazorpayException) {
Timber.e(e)
}
private fun startPayment(order: Order) {
val checkout = Checkout()
checkout.setKeyID("my key my secret key")
/*
* You need to pass current activity in order to let Razorpay create CheckoutActivity
* */
val activity: Activity = this
try {
checkout.open(activity, order.toJson())
} catch (e: Exception) {
Toast.makeText(activity, "Error in payment: " + e.message, Toast.LENGTH_LONG).show()
e.printStackTrace()
}
}
It was my mistake
checkout.setKeyID("my key my secret key")
I needed to provide only "my key" here. the method name literally saying that "setKeyID".