#prodigiousGhost

1 messages Β· Page 1 of 1 (latest)

kindred scrollBOT
hoary echo
#

Ah yeah could be. Can you share how you're deep linking and handling return urls?

hollow fable
#

Under URL types i have this

#

I have tried a few different variations, but not sure

#
// MARK: FIREBASE GOOGLE SIGN IN & STRIPE
    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
        print("AppDelegate - ", url)
        let stripeHandled = StripeAPI.handleURLCallback(with: url)
        if (stripeHandled) {
            return true
        } else {
            // This was not a Stripe url – handle the URL normally as you would
            // Firebase google sign in
            return GIDSignIn.sharedInstance.handle(url)
        }
    }

#

within this, I also handle login via google, so please ignore that code

kindred scrollBOT
gleaming hatch
#

hello! just stepping in, give me a sec to read

hollow fable
#

sure

gleaming hatch
#

what is the returnURL you're setting on PaymentSheet.Configuration() instance? I assume you're using that

hollow fable
#

"your-app://stripe-redirect"

#

but instead of "your-app" it is with the app name

gleaming hatch
#

let me have a look in my own sample project

hollow fable
#

Thank you

gleaming hatch
#

ok sorry that took a while, Xcode had to install components cause ofcourse lol

#

try this, lets say your return URL is mygoodapp

set that as both identifier and URL Scheme in the screenshot above

#

then, just in a Safari window, enter the URL mygoodapp and press enter

#

I expect that should redirect back to your app

hollow fable
#

I am trying this now

#

Yes, it is working

gleaming hatch
#

good!

#

now try the same in your code, with returnURL as "mygoodapp://stripe-redirect"

hollow fable
#

i should leave the identifier and url type as mygoodapp, and just change the returnUrl in code ?

gleaming hatch
#

try with hardcoding mygoodapp first, just to make sure things work first

#

then we can generalize later once we have confidence

hollow fable
#

it didn't work :/

gleaming hatch
#

1/ can you share the URL scheme screenshot again

2/ can you share your PaymentSheet code snippet?

hollow fable
#

ok now there is no error, but nothing happens, even when I manually tap the return to merchant button

gleaming hatch
#

I'm confused, what changed between this repro and the last one? what would result in 2 diff results?

hollow fable
#

the first one was my bad, I didnt run the project properly lol

#

the second one is the outcome of the code changes you requested

gleaming hatch
#

gotcha

hollow fable
#

is it supposed to have this behaviour ?

#

is the user expected to close the tab manually ?

gleaming hatch
#

no deep linking works

#

my sample app is really outdated so asking a colleague who is on a recent version of PaymentSheet

hollow fable
#

No worries

#

I was wondering, separately, are we required to use the address element when collecting a customer shipping address? Is it ok if we pass in the shipping address to the api manually, and only collect the billing address (if need be) via paymentSheet?

kindred scrollBOT
gleaming hatch
#

yes you can collect your own shipping address and pass it on to the PaymentIntent

hollow fable
#

Ok, that's good

abstract thistle
#

Hello! The fact that it's saying it's not a valid URL indicates the app isn't indicating it will handle that URL scheme. Is this in the simulator or on device? If it's the simulator can you try removing the app and reinstalling it, and also try a simulator restart?

hollow fable
#

This is on the simulator. I will try those things now

#

Hi, it does the same thing

#

when i manually copy and paste the link into safari, it does switch back to the app. But the app remains on the screenshot as shown above. I still have to manually close the window

abstract thistle
#

Oh, maybe I misunderstood. I thought you were getting the "address is invalid" error?

hollow fable
#

Yeah, that's been sorted now

#

I think it was hmunoz, recommended to change the Id and URL to the same

abstract thistle
#

Okay, so you go through the payment flow, authentication is required, you complete that, then you land on the "return to merchant" screen and need to manually go back rather than it being automatic?

hollow fable
#

yes, right now it is manual

#

is that how it supposed to be ?

#

clicking on the blue button does not do anything either

abstract thistle
#

No, if the return URL is set up properly it should be automatic.

hollow fable
#

What else can I do ?

abstract thistle
#

Can you share a screenshot of your current URL types from Xcode? I think you changed it since the screenshot above.

hollow fable
#

Sorry, I don't really know how the url types work, so not sure if it contains sensitive info

abstract thistle
#

Hm, can you try using a reverse DNS string for the identifier instead of just mygoodapp?

hollow fable
#

Sure

#

Still the same thing

abstract thistle
#

Hm. So, to clarify, going to Safari and typing in mygoodapp:// switches to your app?

hollow fable
#

yes, although now it is the reverse domain

abstract thistle
#

The reverse domain?

#

To clarify, the identifier (not the URL Schemes) are what should use a reverse DNS string (like com.example.mygoodapp).

hollow fable
#

What should be the URL scheme ?

abstract thistle
#

Just mygoodapp

hollow fable
#

Oh right, let me try that then

#

Would this "mygoodapp://stripe-redirect" be the returnUrl ?

abstract thistle
#

Yes.

hollow fable
#

Same thing

#

I can see that when i copy and paste the url into safari, it does take me back to the app. But does not close the page in the screenshot

abstract thistle
#

Setting up the return URL and the custom URL scheme should make the return part automatic. I do not know why it's not working for you. Have you tried on an actual device? Any difference there?

hollow fable
#

I currently don't have access to an actual, device, I will try shortly

hollow fable
#

Hey, same thing on a physical device

hoary echo
#

Hi there. Rubeus had to step away

#

Can you summarize what you're currently blocked on?

hollow fable
#

The authentication window does not auto-dismiss even though deeplinks seem to be working. I have tested this on both simulator and physical device, same result on both

hoary echo
#

Oh hm

#

Let me read back through these messages to see if there's any clues

hollow fable
#

Thank you

hoary echo
#

Can you share a screen recording of what's exactly happening currently? Want to make sure I understand

#

Currently as in after all the changes Rubeus suggested

hollow fable
#

Ok sure

#

Can you give me some time please, I just stepped away from the computer πŸ˜…

hoary echo
#

No worries

kindred scrollBOT
hollow fable
lyric fractal
#

Thank you, looking at this on our end.

abstract thistle
#

Hello again! So in that flow, can you look in the web developer console and see if there are any warnings or errors?

#

You can use Safari to open dev tools for a web view in the simulator.

#

If you're not familiar with that approach I can give you specific instructions.

hollow fable
#

Nothing's being logged

abstract thistle
#

Nothing at all?

hollow fable
#

maybe i'm not doing it properly? I went to safari on my desktop and opened dev tools for the simulator

abstract thistle
#

You went to the Develop menu in Safari and selected the simulator context, correct? It should highlight in the simulator when you hover over the right one.

hollow fable
#

Yes

abstract thistle
#

Hm. Try this: open the dev tools when you're on the Stripe page with the two Complete for Fail Authentication buttons. Go to the Network tab, make sure Preserve Log is checked, then proceed through the flow and see if anything interesting appears in the results.

#

You can use the little trash can icon in the top right of that tab to clear the results before you start if you want to start from a blank slate.

hollow fable
#

nothing out of the ordinary i think ?

abstract thistle
#

Yep, that's normal. Nothing about an attempt to hit mygoodapp://stripe-redirect though?

#

After you get to the return to merchant page?

hollow fable
#

no, nothing :/

abstract thistle
#

And there's nothing in the filter box, right?

#

The field that says "Filter Full URL" in my screenshot?

hollow fable
#

this is correct right ?

hollow fable
abstract thistle
#

Yep, that looks fine.

#

Is there any output in the Console tab, or is it just blank?

hollow fable
#

blank

abstract thistle
#

Can you give me the Setup/Payment Intent ID you're using? Maybe it will yield a clue.

hollow fable
#

sure

#

seti_1MzSsHBUu6xpCsAudXcfejrt_secret_Nkyp3RxBvQhrsSKUd46R5tnNHrQIeSj

abstract thistle
#

Looks like that one has only been created, can you go through the payment flow so I can see what it looks like after confirmation?

hollow fable
#

I am just saving card details for use later

#

so there wouldnt be a payment

abstract thistle
#

Ah, right, sorry, I just meant the transaction flow.

#

Like all the way to the return to merchant page.

hollow fable
#

sure

#

do you want me to fail authentication ?

abstract thistle
#

No, succeed.

hollow fable
#

ok

#

done

abstract thistle
hollow fable
#

yup

abstract thistle
#

πŸ€”

#

Does anything interesting pop up in the Network or Console tab when you tap on the return to merchant button?

hollow fable
#

nothing

#

remains blank

#

So the issue is, that the window does not auto-close

abstract thistle
#

Yep.

hollow fable
#

just wanted to make sure

#

cool

#

if it's ok with you, can i come back in 20 mins? gonna grab dinner quick, its past midnight now

abstract thistle
#

Yep, that's fine.

hollow fable
#

thank you

abstract thistle
#

While you're gone I'm going to share screenshots and whatnot of the example app's configuration and code that's working on my end...

hollow fable
#

sure

abstract thistle
#

Code: configuration.returnURL = "payments-example://stripe-redirect"

#

This example app uses a SceneDelegate to handle URLs:

#

Wait...

#

You shared this code earlier:

// MARK: FIREBASE GOOGLE SIGN IN & STRIPE
    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
        print("AppDelegate - ", url)
        let stripeHandled = StripeAPI.handleURLCallback(with: url)
        if (stripeHandled) {
            return true
        } else {
            // This was not a Stripe url – handle the URL normally as you would
            // Firebase google sign in
            return GIDSignIn.sharedInstance.handle(url)
        }
    }
#

Is that print("AppDelegate - ", url) firing? If so, what does it print out?

hollow fable
#

Soooooo

#

It’s either or appDelegate / Scene delegate ?

#

You can do both?

abstract thistle
#

You can do either. Really it's about where you want your URL handler code to reside.

hollow fable
#

I’m using both to handle urls

abstract thistle
#

There's, ummm....

#

Are you handling Stripe URLs in both places?

hollow fable
#

Yes

abstract thistle
#

With StripeAPI.handleURLCallback() I mean?

hollow fable
#

Yeah

abstract thistle
#

Can you add logging to both places and see which (or if either) is called?

hollow fable
#

Yup

#

lol

#

nothing is being logged

#

from either places

abstract thistle
#

Hmmmmmmm.

#

What if you invoke the app from Safari by typing in mygoodapp://test?

hollow fable
#

nothing

abstract thistle
#

Uh... πŸ˜…

#

Search your entire codebase for instances of OpenURLOptionsKey and openURLContexts and open url and see if there are any other places where this could be handled.

#

Also search for AppDelegate and SceneDelegate and make sure there aren't ones floating around without URL handlers.

hollow fable
#

ooo

#

so i found another method within scenedelegate

#

but... it should still print out the url as i have a print statement there

abstract thistle
#

Hm.

#

Maybe it's some really strange build artifact bug? In Xcode if you go to the Product menu and choose Clean Build Folder... and then do a fresh, clean build does that get any of those print calls to work?

#

Also, just thinking of anything else it could possibly be, are other print() calls working? Is your app logging other stuff in the debugger?

#

Anything in the filter field in the debugger?

hollow fable
#

nope nothing in the filter field

#

rebuilding the app now

abstract thistle
#

Maybe also delete it from the simulator?

#

Just to rule out any possible artifacts there.

hollow fable
#

yup

#

its workingggg

abstract thistle
#

OMG

hollow fable
#

but its cos i messed up bad

abstract thistle
#

πŸŽ‰

#

I mean, I wasn't celebrating you messing up to be clear. πŸ˜…

#

What happened?

hollow fable
#

In the scene delegate, I was using the continue UserActivity method and not the openURLContext even though i was using that method within the AppDelegate

abstract thistle
hollow fable
#

yeah

abstract thistle
#

Ah, yep, that one not being called for a URL makes sense.

hollow fable
#

but it should have worked because i was checkign to make sure the activity was of type safaribrowsing

abstract thistle
#

But hey, I'm just glad it's working!

hollow fable
#

It works for my google sign in code

abstract thistle
#

I don't think the user activity method gets called when it's a Safari View Controller within your own app.

#

Not 100% sure though.

hollow fable
#

Yeah makes sense

#

So glad it's fixed

#

thank you so much

abstract thistle
#

Happy to help!

hollow fable
#

I would never have even looked twice, it was only when you shared your sample SceneDelegate code i saw the mistake I made

#

Also, I have some questions regarding how to move forward for the use case of my app. Is this the best place to ask ?

abstract thistle
#

Yep, shoot!

hollow fable
#

The app we are making at the moment allows users to buy and sell items on a marketplace. You can also bid for items too. When purchasing, we require them to select a payment method, then choose shipping and if need be, add any coupons etc. The issue is due to their shipping address changing, or them adding a coupon code the price may change, So if we were using the paymentSheetFlowController to select payment, how can we confirm if there isn't any price attached ?

#

i am not sure if that makes sense

#

Additionally, can a customer also be a Connect customer? We have to use Connect accounts for sellers and handling payouts

abstract thistle
#

I was following along until that last part... is the core issue that you have a Payment Intent with an amount already set, you use that to initialize the Payment Sheet, but then you need to change the amount based on other information provided?

#

No, Customers are separate from Connect accounts. Customers are objects that live inside a Stripe Account and represent people paying that account.

hollow fable
#

I see

#

Sorry, I am using a setupIntent

#

to display the payment-sheet to the user, they select a method

abstract thistle
#

So with Setup Intents there's never an amount or price attached.

hollow fable
#

then they select their shipping address

#

Yes, so how can I attach the price ?

abstract thistle
#

You would need to use a Payment Intent if you want to collect payment.

hollow fable
#

right at the bottom, where you can confirm

#

what does that do then ?

abstract thistle
#

That's using a Payment Intent. See in the code where it says paymentIntentClientSecret?

hollow fable
#

oh

#

I'm stupid lol

abstract thistle
#

Let's take a step back from the specifics though. Can you describe your ideal payment flow?

hollow fable
#

sure

abstract thistle
#

Or, rather, your ideal payment method collection and payment flows, if they're separate?

hollow fable
#

so when buying, users select their payment method, then shipping and essentially buy

#

however, if they are bidding, we should be able to store their payment method, and charge them at a later date if the seller agrees with their bid

abstract thistle
hollow fable
#

Users can also sell items, I believe we will have to use Connect accounts for this, they choose the item they want to sell, choose their payout method, then list the item. If the item sells, the funds from the buyer should come to us first. The seller has to ship their items to our warehouse, then at which point if the item is as it should be, we will release the sellers portion of the sale to them

abstract thistle
#

If you only want to collect payment info for later use, without taking a payment, the guide you're following now is the correct one.

#

That's correct, yep, Connect is required for what you want to do.

hollow fable
abstract thistle
#

Yeah.

hollow fable
#

Ok, is it possible to update the paymentIntent ?

#

once i create a paymentIntent for lets say 100USD

#

then the user adds a coupon, i can updated the paymentIntent to 90USD, without having to make the user select a payment method again right ?

abstract thistle
#

Kinda, but not really. The flow is create Payment Intent for specific amount > use client secret to show Payment Sheet > customer pays that amount. You can't practically change the amount after the Payment Sheet is displayed.

#

You should do all of the stuff that determines the amount first, then create the Payment Intent for the final amount, then show the Payment Sheet.

#

So address selection, coupons, etc... all of that should happen before you create the Payment Intent.

hollow fable
#

ah

#

this is gonna mess up the design lol

abstract thistle
hollow fable
#

Damn, sounds like exactly what i need

abstract thistle
#

Probably. πŸ˜…

hollow fable
#

Well, thank you for your help, quite literally spent hours on this issue

#

It feels good to go to bed with this sorted lol

#

Hope you have a great day/night

abstract thistle
#

Happy to help! Sorry it took so long, but glad we got there in the end!

#

You too! Good luck with the rest of your integration!

hollow fable
#

No worries, its done now and thats all that matters