Stripe Universal Link Redirect

Hi,

I am using SwiftUI to code an e-commerce marketplace application. For this, I am using Stripe for the transactions. I have an API call to Stripe for getting the link for displaying in-app WebView of Stripe seller onboarding. This method is called in the following way:

 const accountLink = await stripe.accountLinks.create({
   account: accountID,
   refresh_url: "https://siftresale.com/stripe-refresh-url",
   return_url: "https://siftresale.com/stripe-return-url",
   type: "account_onboarding",
 });

Stripe support validated that this is the correct way to call this method. After calling this method, I get back a URL. Then, I assign this URL to a state variable. The application shows a WebView when this URL is not empty. As you can see in the attachment, I am able to display Stripe onboarding but the redirect is unsuccessful.

The way I set up the redirect is by universal links on the two given urls in the above API call. We own the domain for siftresale.com. I have "applinks:siftresale.com" in my domains in Xcode. I have the following apple-app-site-association file in my domain:

{
  "applinks": {
    "apps": [],
    "details": [
      {
        "appID": "53U82H29KZ.edu.princeton.eLab.Sift.SiftApp",
        "paths": [ "/stripe-refresh-url", "/stripe-return-url"]
      }
    ]
  }
}

Using my iPhone, I looked at phone logs and the swcutil_show.txt file contains the following information:

Service:              applinks
App ID:               53U82H29KZ.edu.princeton.eLab.Sift.SiftApp
App Version:          1.0
App PI:               <LSPersistentIdentifier 0x101579660> { v = 0, t = 0x8, u = 0x9dc, db = 9A95A5E5-A416-4FA7-8E02-28C0916C8C0B, {length = 8, bytes = 0xdc09000000000000} }
Domain:               siftresale.com
Patterns:             {"/":"/stripe-refresh-url/"}, {"/":"/stripe-return-url/"}
User Approval:        unspecified
Site/Fmwk Approval:   approved
Flags:                
Last Checked:         2022-07-24 23:50:57 +0000
Next Check:           2022-07-29 23:47:25 +0000

This makes me think that the universal link is correctly identified by the app. Lastly, on the app I have this code block for responding to the code but nothing prints:

ContentView{...}.onOpenURL(perform: {url in
    print(" i am here")
    let stripeHandled = StripeAPI.handleURLCallback(with: url)
    if(stripeHandled){
        if let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: true) {
            if let queryItems = urlComponents.queryItems {
                var params = [String: String]()
                queryItems.forEach{
                    params[$0.name] = $0.value
                }
                print(params)
            }
        }
    }
})

I would really appreciate it any sort of help on this because there are very limited resources on this.

Attachment: Screen recording of app behavior

https://drive.google.com/file/d/1ttF9deh1iVJ1kaIM58Vg5fosyIoiInsb/view?usp=sharing

Post not yet marked as solved Up vote post of eahn Down vote post of eahn
1.5k views

Replies

Were you able to get AccountLinks working?

Did you resolve this? Going through the same issue right now but with an ASWebAuthenticationSession