razorpay / razorpay-pod

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

Webkit Errors in Standard SDK #122

Open SeniorTechLead opened 3 years ago

SeniorTechLead commented 3 years ago

Hi,

Xcode: Version 12.4 (12D4e) Razorpay SDK: Razorpay Standard SDK 1.2.10 Swift: 5.1

I'm trying to call your view controller as a ViewControllerRepresentable in SwiftUI. If you have any documentation or guidance on how to integrate your gateway with SwiftUI, please let us know. Even otherwise, if you can guide us on how to make this work in SwiftUI, many developers and companies will use your gateway.

1) When the form is opened, these are the errors that show up:


DEBUG PRINT: In viewDidLoad(): Now initializing with key //Also tried placing this in viewWillAppear() DEBUG PRINT: The options are: ["name": "ABC", "amount": "100", "theme": ["color": "#ffff00"], "currency": "INR", "description": "purchase description", "prefill": ["email": "foo@bar.com", "contact": "9797979797"], "image": "https://url-to-image.png"]


2021-03-20 05:10:30.579072-0700 ABC[34301:733343] -canOpenURL: failed for URL: "tez://upi/pay" - error: "This app is not allowed to query for scheme tez" 2021-03-20 05:10:30.579671-0700 ABC[34301:733343] -canOpenURL: failed for URL: "phonepe://pay" - error: "This app is not allowed to query for scheme phonepe" 2021-03-20 05:10:30.580277-0700 ABC[34301:733343] -canOpenURL: failed for URL: "paytmmp://upi/pay" - error: "This app is not allowed to query for scheme paytmmp" 2021-03-20 05:10:30.580768-0700 ABC[34301:733343] -canOpenURL: failed for URL: "tez://upi/pay" - error: "This app is not allowed to query for scheme tez" 2021-03-20 05:10:30.581253-0700 ABC[34301:733343] -canOpenURL: failed for URL: "phonepe://pay" - error: "This app is not allowed to query for scheme phonepe" 2021-03-20 05:10:30.581707-0700 ABC[34301:733343] -canOpenURL: failed for URL: "paytmmp://upi/pay" - error: "This app is not allowed to query for scheme paytmmp"

2) When the payment is successfully done and closed, these are the errors that show up. Is Webkit even supposed to be invoked for the standard SDK?

payment successful pay_GouJlrcoE7Yqgz /Users/sachinnautiya/Documents/ABC/razorpay-ios/RazorpayIOS/CheckoutOtpelf/Classes/RazorpayCheckoutVC.swift deinitialized /Users/sachinnautiya/Documents/Razorpay/razorpay-ios/RazorpayIOS/CheckoutOtpelf/Classes/RazorpayCheckoutWebView.swift:["/Users/sachinnautiya/Documents/Razorpay/razorpay-ios/RazorpayIOS/CheckoutOtpelf/Classes/RazorpayCheckoutWebView.swift deinitialized"] 2021-03-20 05:26:26.832404-0700 ABC[34426:748782] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}> 2021-03-20 05:26:26.832520-0700 ABC[34426:748782] [ProcessSuspension] 0x1218fe2c0 - ProcessAssertion: Failed to acquire RBS Background assertion 'WebProcess Background Assertion' for process with PID 34433, error: Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing} 2021-03-20 05:26:26.839750-0700 ABC[34426:748782] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}> 2021-03-20 05:26:26.839837-0700 ABC[34426:748782] [ProcessSuspension] 0x1218fe340 - ProcessAssertion: Failed to acquire RBS Background assertion 'WebProcess Background Assertion' for process with PID 34433, error: Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist} 2021-03-20 05:26:26.842842-0700 ABC[34426:748782] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}> 2021-03-20 05:26:26.842930-0700 ABC[34426:748782] [ProcessSuspension] 0x1218fe380 - ProcessAssertion: Failed to acquire RBS Background assertion 'WebProcess Background Assertion' for process with PID 34433, error: Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist} 2021-03-20 05:26:26.844244-0700 ABC[34426:748782] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}> 2021-03-20 05:26:26.844323-0700 ABC[34426:748782] [ProcessSuspension] 0x1218fe3c0 - ProcessAssertion: Failed to acquire RBS Background assertion 'WebProcess Background Assertion' for process with PID 34433, error: Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist} 2021-03-20 05:26:56.813826-0700 ABC[34426:748782] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service 2021-03-20 05:26:56.846457-0700 ABC[34426:748782] Could not signal service com.apple.WebKit.Networking: 113: Could not find specified service

Screen Shot 2021-03-20 at 4 18 21 PM Screen Shot 2021-03-20 at 7 25 22 PM Screen Shot 2021-03-20 at 7 25 49 PM
Nautiyalsachin commented 3 years ago

Hi @SeniorTechLead, Right now we don't have our SDK in SwiftUI.

We are planning to take it up in future as there are still some issues coming up in SwiftUI. We will keep you posted here as soon as we release anything.

For error 1, you can see our Intent on iOS implementation, where we are showing the available UPI apps by searching in users phone. Check above link for more details.

error 2 -

These errors are OS generated and we can't control them from our side.

If you want to remove the above errors from the XCode's console then follow these steps.

  1. Select Product => Scheme => Edit Scheme or use shortcut : CMD + <
  2. Select the Run option from left side.
  3. On Environment Variables section, add the variable OS_ACTIVITY_MODE = disable
SeniorTechLead commented 3 years ago

Thanks, Sachin. Unfortunately, that doesn't solve either of the two problems. We had already tried adding the keys in the info.plist file. All that it does is change the error message. We would have been even okay with silencing the OS errors like the way you mentioned had there been a way to prevent the respective apps from being tried to be opened.

We'll appreciate any insights you might have on this.


2021-03-30 23:41:33.010134-0700 ABC[3661:273640] WF: _userSettingsForUser : (null) 2021-03-30 23:41:33.010244-0700 ABC[3661:273640] WF: _WebFilterIsActive returning: NO 2021-03-30 23:41:33.119759-0700 ABC[3661:273640] -canOpenURL: failed for URL: "tez://upi/pay" - error: "The operation couldn’t be completed. (OSStatus error -10814.)" 2021-03-30 23:41:33.120319-0700 ABC[3661:273640] -canOpenURL: failed for URL: "phonepe://pay" - error: "The operation couldn’t be completed. (OSStatus error -10814.)" 2021-03-30 23:41:33.120834-0700 ABC[3661:273640] -canOpenURL: failed for URL: "paytmmp://upi/pay" - error: "The operation couldn’t be completed. (OSStatus error -10814.)" 2021-03-30 23:41:33.121398-0700 ABC[3661:273640] -canOpenURL: failed for URL: "tez://upi/pay" - error: "The operation couldn’t be completed. (OSStatus error -10814.)" 2021-03-30 23:41:33.121918-0700 ABC[3661:273640] -canOpenURL: failed for URL: "phonepe://pay" - error: "The operation couldn’t be completed. (OSStatus error -10814.)" 2021-03-30 23:41:33.122430-0700 ABC[3661:273640] -canOpenURL: failed for URL: "paytmmp://upi/pay" - error: "The operation couldn’t be completed. (OSStatus error -10814.)" /Users/sachinnautiya/Documents/Razorpay/razorpay-ios/RazorpayIOS/CheckoutOtpelf/Classes/RazorpayCheckoutVC.swift deinitialized /Users/sachinnautiya/Documents/Razorpay/razorpay-ios/RazorpayIOS/CheckoutOtpelf/Classes/RazorpayCheckoutWebView.swift:["/Users/sachinnautiya/Documents/Razorpay/razorpay-ios/RazorpayIOS/CheckoutOtpelf/Classes/RazorpayCheckoutWebView.swift deinitialized"]

Screen Shot 2021-03-30 at 11 55 08 PM
Nautiyalsachin commented 3 years ago

Regarding these warnings, we are querying apps URIs with iOS. We don't have much of a control here on this. As per the implementation as soon as we are hitting canOpenURL, it gives the above warnings in the console.

SeniorTechLead commented 3 years ago

Hi Sachin,

Thanks for the clarifications!

What we are surmising is that there isn't a way to trap (in the view controller) errors in opening apps. That said, is there a way to avoid calling these three external wallets. What we have observed is that even if we don't list them in the "wallets" key or even if we drop the "external" key altogether in the "options" dictionary, they don't show up as options, but they still are tried to be opened; of course, we do remove them from info.list when we try that.

Nautiyalsachin commented 3 years ago

@SeniorTechLead These are not for wallet and these are for UPI Intent flow, where users don't have to type their UPI Id manually rather they will be redirected to the selected UPI App.

Before showing the UPI app on our page, we are querying it from iOS for the app's availability, that's why those errors are coming. Click here for more details on UPI Intent.

Give us some time to implement this feature where you can disable the intent flow using some keys in options.

DLP-ios commented 2 years ago

Hi guys, can anyone help me how to open only phone pe wallet without default checkout in ios swift

DLP-ios commented 2 years ago

I am unable to open without middle checkout . I am using below parameters a below mentioned, let options: [String:Any] = ["currency": "INR", "amount": a, "contact": "8500116090", "email": "dubaprasad@gmail.com", "method": "wallet", "wallet": "phonepe", "order_id": info.id] self.razorpay?.open(options)

PrathapiOS commented 2 years ago

@Nautiyalsachin We have implemented Razorpay in our app. We have our custom UI to enter UPI id. And, when we click on UPI id - we are end up with this error. "Attempt to add script message handler with name 'CheckoutBridge when one already exist"

Can you please help me with this?

ramprasadAnand commented 1 year ago

@PrathapiOS you are trying to initialise the Razorpay instance more than once, this is the cause of this error. Please check and let us know if you still face the safe error.