#kenoy-3DS
1 messages · Page 1 of 1 (latest)
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
}```
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?
yep you can definitely use a URL scheme, that's what I use in my own apps and it works fine
I get an error along the lines of an invalid URL…
https://stripe.com/docs/payments/accept-a-payment?platform=ios&ui=payment-sheet#ios-set-up-return-url are the docs and what I use.
any more details like the exact error message?
also you have to do it on the frontend in the SDK which maybe is the problem(I'm not convinced the backend API accepts non http URL)
// 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.
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 :
🙂
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
no, it's all public, but code is not generally sensitive