#kenoy-3DS

1 messages · Page 1 of 1 (latest)

ionic elk
#

Hi there, How did you set up the universal link ?

#

Does your iOS app handle opening universal link the same way as shown in the example code?

#
// This method handles opening universal link URLs (for example, "https://example.com/stripe_ios_callback")
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool  {
    if userActivity.activityType == NSUserActivityTypeBrowsingWeb {
        if let url = userActivity.webpageURL {
            let stripeHandled = StripeAPI.handleURLCallback(with: url)
            if (stripeHandled) {
                return true
            } else {
                // This was not a Stripe url – handle the URL normally as you would
            }
        }
    }
    return false
}```
silver rapids
#

Hi Jack, yes the app is already handling universal links accurately from EDM for example.
However, when debugging It doesn’t even reach this point. I’m guessing it’s because it’s a presented SafariViewController for the 3DS authentication.
Also, using SwiftUI if that makes a difference

Is there no way to use our URL Scheme?

knotty field
#

yep you can definitely use a URL scheme, that's what I use in my own apps and it works fine

silver rapids
#

I get an error along the lines of an invalid URL…

knotty field
knotty field
#
// MARK: Create a PaymentSheet instance
        var configuration = PaymentSheet.Configuration()
        configuration.merchantDisplayName = "Example, Inc."
        configuration.returnURL="com.karl-ios://sheet-redirect"
        configuration.allowsDelayedPaymentMethods = true
        configuration.applePay = .init(
        merchantId: "merchant.******",
        merchantCountryCode: "IE"

AppDelegate

// This method handles opening native URLs (e.g., "yourexampleapp://")
    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
        print("got url callback " + url.absoluteString)
        let stripeHandled = StripeAPI.handleURLCallback(with: url)
        if (stripeHandled) {
            print("stripe handled it")
            return true
        } else {
            // This was not a stripe url – do whatever url handling your app
            // normally does, if any.
        }
        return false
    }

is what I do and it all works fine.

silver rapids
#

hmmm, not using the payment sheet approach at the moment.
Using STPPaymentHandler.shared().confirmPayment
and specifying the returnURL on the STPPaymentIntentParams

#

I'm new to discord, is this subthread private?

#

Wondering if I can share real code here

#

Error Domain=com.stripe.lib Code=50 "There was an unexpected error -- try again in a few seconds" UserInfo={com.stripe.lib:ErrorParameterKey=returnUrl, NSLocalizedDescription=There was an unexpected error -- try again in a few seconds, com.stripe.lib:ErrorMessageKey=Not a valid URL, com.stripe.lib:StripeErrorTypeKey=invalid_request_error, com.stripe.lib:StripeErrorCodeKey=url_invalid}

#

Oh I know what it is

#

lol, silly. I should have something beyond the ://

#

Thanks for your help :

#

🙂

knotty field
#

yes for some reason that catches a lot of people out

#

you can't just use the scheme, it needs to be a full URL

knotty field