Search code examples
iospaypalbraintree

No Payment Option After Passing ClientToken to BTDropInController


  1. I get no Payment Option after passing clientToken to BTDropInController in iOS.

  2. BUT when I do hardcode the clientToken and that clientToken is from your Hello-Client sample (https://developers.braintreepayments.com/start/hello-client/ios/v4), there is a payment method on the DropIn.

  3. When hardcoding the clientToken generated from our server using Postman, it does not work as well.

  4. When I generated a clientToken from our server using the iOS app without passing it to the BTDropInController` yet, and share that to my colleague (Android Developer), his Android app shows up the Payment option which is PayPal.

Some code:

    private func showBraintreeDropInWithToken(_ clientToken: String, subscription: Subscription) {
        let request = BTDropInRequest()
        let dropIn = BTDropInController(authorization: clientToken, request: request) { (controller, result, error) in
            if let error = error {
                self.showAlert("Payment gateway request failed. \(error.localizedDescription)", withCallBack: {
                    controller.dismiss()
                })
                return
            }

            if let result = result {
                if result.isCancelled {
                    controller.dismiss()
                    return
                }
                // Use the BTDropInResult properties to update your UI
                // result.paymentOptionType
                // result.paymentMethod
                // result.paymentIcon
                // result.paymentDescription
            }
        }

        self.tabBarController?.present(dropIn!, animated: true, completion: nil)
    }

Solution

  • SOLVED!

    https://github.com/braintree/braintree_ios/issues/393#issuecomment-371891330

    Just install the PayPal dependency and you're all set, don't forget too the additional setup for Url Schemes.

    enter image description here