Search code examples
iosswiftrazorpay

Module 'Razorpay' has no member named 'initWithKey' in swift


I am new in iOS and I am using Xcode 12.3 I am facing issue with razorpay Since I updated my Xcode. I Updated my Razorpay to 'razorpay-pod', '~> 1.1.12' but it shows still the same issue. Did someone face this issue and is there is any solution to resolve it.Thanks in Advance!


Solution

  • Quoting from https://razorpay.com/docs/payment-gateway/ios-integration/standard/

    Use Variable RazorpayCheckout for Swift versions 5.1+: For Swift version 5.1+, ensure that you declare var razorpay: RazorpayCheckout!. For versions lower than 5.1, you may use var razorpay: Razorpay!.

    Alternatively, you can use the following alias and retain the variable as Razorpay.

    typealias Razorpay = RazorpayCheckout

    You should switch to RazorpayCheckout from Razorpay.

    razorpay = RazorpayCheckout.initWithKey(razorpayTestKey, andDelegate: self)