braintree / braintree_ios

Braintree SDK for iOS
https://developer.paypal.com/braintree/docs/start/hello-client/ios/v5
MIT License
560 stars 294 forks source link

How can i test venmo in India #787

Closed anniemark271983 closed 2 years ago

anniemark271983 commented 2 years ago

Also need to check bellow error

var venmoDriver: BTVenmoDriver! = nil

override func viewDidLoad() {

let apiClient = BTAPIClient(authorization: PAYMENT_KEY.Paypal)
venmoDriver = BTVenmoDriver(apiClient: apiClient!)

if !(venmoDriver?.isiOSAppAvailableForAppSwitch() ?? false) {
    viewforVenmo.isHidden = true
}

func getVenmoToken() {
    let venmoRequest = BTVenmoRequest()
    venmoRequest.profileID = PAYMENT_KEY.Venmo
    venmoRequest.displayName = APPLICATION_NAME
    venmoRequest.paymentMethodUsage = .singleUse

    venmoDriver.tokenizeVenmoAccount(with: venmoRequest) { (nonce, error) in
        Utils.hideProgress()
        if let e = error {
            Utils.showAlertWithOK(self, strMessage: "Payment Error ->\(e.localizedDescription)")
        } else if let n = nonce {
            Utils.showAlertWithOK(self, strMessage: "Payment Done")
        } else {
            Utils.showAlertWithOK(self, strMessage: "Canceled")
        }
    }
}

}

jaxdesmarais commented 2 years ago

Hello @anniemark271983 -

Venmo is currently available only for merchants and customers in the US. To test in India you would likely need to use something like a VPN with a location in the US. As this is outside of the scope of the SDK, we cannot speak to how to set this up, but other merchants have had success with similar solutions.

The Utils class is not developed by Braintree, so I cannot speak to why the alerts are not showing. Are you able to add print statements to the above so we can troubleshoot further and let us know the results of what is printed. Something like the following:

    venmoDriver.tokenizeVenmoAccount(with: venmoRequest) { (nonce, error) in
        Utils.hideProgress()
        if let e = error {
            print(e.localizedDescription)
        } else if let n = nonce {
            print(n)
        } else {
            print("Cancelled")
        }
    }

Additionally, can you confirm that you are making it into the tokenizeVenmoAccount function at all?

anniemark271983 commented 2 years ago

My Utils is as bellow, Also I have checked with print method nothing is print

class Utils { class func showAlertWithOK(_ viewDelegate: AnyObject,strMessage:String){ let alertController = UIAlertController(title: nil, message: strMessage, preferredStyle: .alert) alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) viewDelegate.present(alertController, animated: true, completion: nil) } }

also, how can I set the price while requesting on Venmo payment?

jaxdesmarais commented 2 years ago

Also I have checked with print method nothing is print

If nothing is being printed, that leads me to believe that you are not making it into your getVenmoToken() function. Where is this function being called? I would recommend adding some additional logging as that will help us troubleshoot the issue you are having to know where in your code you are running into issues.

also, how can I set the price while requesting on Venmo payment?

You will pass an amount in when you create a transaction on the server passing in the nonce from the client along with device data.

jaxdesmarais commented 2 years ago

Closing this issue due to inactivity. Please feel free to reopen this issue if you are still running into issues and we would be happy to help troubleshoot further.

jaxdesmarais commented 2 years ago

Posting message from #810:

I am not getting called back after opening the Venmo application, Paypal is working fine and getting calls back in the application and also the nonce

so can you please let me know what is the issue here?

The below open URL method is called proper while Paypal payment but it's not call while Venmo payment

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {

print("application option URL->",url) if (url.scheme?.hasPrefix("fb"))! { ApplicationDelegate.shared.application(UIApplication.shared,open: url,sourceApplication: nil,annotation: [UIApplication.OpenURLOptionsKey.annotation]) } else if (url.scheme?.hasPrefix("google"))! { return GIDSignIn.sharedInstance.handle(url) } else { if url.scheme?.localizedCaseInsensitiveCompare("com...payments") == .orderedSame { return BTAppContextSwitcher.handleOpenURL(url) } }

return false }

Please confirm that you have followed the steps to:

  1. Register your URL scheme for Venmo.
  2. Once you register your URL scheme, you should test it to ensure it's working as expected.
  3. From there, you will need to handle the app switch by calling BTAppContextSwitcher's handleOpenURL method from within the application:openURL:options app delegate method. If you take a look at your code compared to the example, you will see that you need to add in your URL scheme registered in step 1.
jaxdesmarais commented 2 years ago

Hello @anniemark271983 - I am closing this issue again due to inactivity. Please feel free to reopen this issue with the answers to the above questions if you are still running into issues and we would be happy to help troubleshoot further.