razorpay / razorpay-pod

:iphone: CocoaPod implementation of Razorpay's Payment SDK. Refer for instructions:
https://docs.razorpay.com/v1/page/ios-integration
MIT License
21 stars 18 forks source link

Razorpay pod installed It is working in viewdidload while ham going to calling button action it is not calling #116

Closed naveenYellamraju closed 3 years ago

naveenYellamraju commented 3 years ago

Description

Please provide a clear and concise description of what the bug is. Include screenshots if needed. Please test using the latest Razorpay pod release to make sure your issue has not already been fixed.

Razorpay pod Version :

Open podfile for checking the razorpay-pod version if it's not mentioned their then open podfile.lock and copy the pod version here.

Xcode Version :

Open Xcode > Go to About Xcode > copy the Xcode version here.

What you did:

What happened:

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

1. 2.

Suggested solution:

Code example, screenshot, or link to a repository:

Please provide a link to a repository on GitHub, or provide a minimal code example that reproduces the problem. You may provide a screenshot of the application if you think it is relevant to your bug report. Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve

naveenYellamraju commented 3 years ago

pod version is :

pod 'razorpay-pod', '~> 1.1.1'  

Xcode : Version 11.5 (11E608c)

What I did:

import UIKit import Razorpay

class RazorPaymentViewController: UIViewController,RazorpayPaymentCompletionProtocol {

var razorpay: RazorpayCheckout!

override func viewDidLoad() {
    super.viewDidLoad()

    razorpay = RazorpayCheckout.initWithKey("rzp_live_f4hQQYwcs1kUTJ", andDelegate: self)
}

override func viewDidAppear(_ animated: Bool) {

         showPaymentForm()
     }

internal func showPaymentForm(){
    let options: [String:Any] = [
                "amount": "10050", //This is in currency subunits. 100 = 100 paise= INR 1.
                "currency": "INR",//We support more that 92 international currencies.
                "description": "purchase description",
               // "order_id": "order_DBJOWzybf0sJbb",
                "image": "https://meraAs.png",
                "name": "business or product name",
                "prefill": [
                    "contact": "9797979797",
                    "email": "foo@bar.com"
                ],
                "theme": [
                    "color": "#fcdc0c"
                ]
            ]
    razorpay.open(options)
}

public func onPaymentError(_ code: Int32, description str: String){
    let alertController = UIAlertController(title: "FAILURE", message: str, preferredStyle: UIAlertController.Style.alert)
    let cancelAction = UIAlertAction(title: "OK", style: UIAlertAction.Style.cancel, handler: nil)
    alertController.addAction(cancelAction)
    //self.view.window?.rootViewController?.present(alertController, animated: true, completion: nil)
    self.present(alertController, animated: true, completion: nil)

}

public func onPaymentSuccess(_ payment_id: String){
    let alertController = UIAlertController(title: "SUCCESS", message: "Payment Id \(payment_id)", preferredStyle: UIAlertController.Style.alert)
    let cancelAction = UIAlertAction(title: "OK", style: UIAlertAction.Style.cancel, handler: nil)
    alertController.addAction(cancelAction)
   // self.view.window?.rootViewController?.present(alertController, animated: true, completion: nil)
    self.present(alertController, animated: true, completion: nil)

}

}

issue is :

in button tap showing error like razorpayCheckout.vc is deintilized

Nautiyalsachin commented 3 years ago

Hey @naveenYellamraju, this is not an error, please try with our sample app and let us know if it works for you.

You can also use your Razorpay key there and see the result with these options.

Nautiyalsachin commented 3 years ago

Closing this issue due to inactivity, feel free to reopen or add comments here. Thanks.