Reputation: 293
I am using,
*Xcode - 10.2
*Swift language version - swift 5
*RazorPay framework version - 1.1.1 (pod 'razorpay-pod', '1.1.1')
My problem is when I am calling this,
razorpay.open(options, displayController: self)
It gives me an unexpected error (code - 1) with
/Users/travis/build/razorpay/razorpay-ios/RazorpayIOS/CheckoutOtpelf/Classes/RazorpayCheckoutVC.swift deinitialized
Solutions I tried were,
Here's my code
import Razorpay
class controller: RazorpayPaymentCompletionProtocol{
private var razorpay: Razorpay!
override func viewDidLoad() {
super.viewDidLoad()
razorpay = Razorpay.initWithKey("test_key", andDelegate: self)
}
func openRazorPay(){
let options = [
"amount" : "12.00"
]
self.navigationController?.isNavigationBarHidden = true
razorpay.open(options, displayController: self)
}
func onPaymentSuccess(_ payment_id: String) {
print("success")
}
func onPaymentError(_ code: Int32, description str: String) {
print("Failure")
}
}
This framework supports Android, but not for iOS. I want to get the payment flow. If anyone has any solution, share with me.
Upvotes: 3
Views: 2885
Reputation: 93
I was facing the same issue And All of the parameters which i was sending to the options was right.
But the issue was when we try to open RazorPay screen for payment was getting the issue of the RazorpayCheckoutVC.swift deinitialized
In my case my parent viewController was presented so i just changed the navigation code of present to the push and then it worked.
So as per my understanding it should be as
NavigationController -> Push ViewController -> RazorPaycheckoutVC.
Upvotes: 1
Reputation: 2419
As I face the same issue......
What I did differently is I take a static amount value 100 and pass the other data as it is.....and I make payment process...it works...open the payment window.
If your amount value less than 100 then it happens...as per doc, the amount we are assigning in the param consider it as a paisa....Try with this one and you will get expected result..
Here what the amount you are passing, make a multiply with 100 e.g 1 x 100. The internal processing will be count it as INR 1, but their calculation is consider it as paisa. So you passed value 100 means 100 paisa and in payment window it will show INR 1.
Upvotes: 1