I am trying to integrate the Razorpay payment gateway from my Xamarin App. For which I have added RezaorPay Dll on the application and pass the needed parameters but problem is that it does not redirect me to the webview.
I am sharing my code here. Kindly go through it and let me know, what are the changes required?
Dictionary<string, object> input = new Dictionary<string, object>();
input.Add("amount", 100); // this amount should be same as transaction amount
input.Add("currency", "INR");
input.Add("receipt", "12121");
input.Add("payment_capture", 1);
string key = "******";
string secret = "******";
RazorpayClient client = new RazorpayClient(key, secret);
Razorpay.Api.Order order = client.Order.Create(input);
orderId = order["id"].ToString();
You can add below code to show you view
Activity activity = this;
try {
JSONObject options = new JSONObject();
options.Put("description", "My Sample Payment activity");
options.Put("order_id", "order_EAMgUyLXrMfbmL");
options.Put("currency", "INR");
options.Put("amount", "100");
checkOut.Open(activity, options);
} catch (Exception ex) {
Console.WriteLine("error in payment");
}
Callback methods.
public void OnPaymentError(int p0, string p1, PaymentData p2) {
Console.WriteLine("error in payment");
}
public void OnPaymentSuccess(string p0, PaymentData p1) {
Console.WriteLine("success");
}