#lelouch

1 messages ยท Page 1 of 1 (latest)

wet patrolBOT
humble pawn
#

Hello, everything was working well

#

both production and development

#

did a build run and then realized issue

wild basin
#

Hm ok. You said everything was working. What did you change before everything broke?

#

Was it on an earlier version when it was working?

humble pawn
#

i changed nothing regarding stripe and yes i later updated Stripe from "0.23.3" to "0.26.0"

wild basin
#

So everything worked on 0.23.3 and upgrading to 0.26.0 is what broke the app?

humble pawn
#

i dont think so, i noticed was not working in 0.23.3 then i made the update thinking maybe something went wrong

wild basin
#

So when was it working?

#

What changed between it working and it breaking?

humble pawn
#

it was working last week very sure of that, worked on other tasks then later on in production a tester notified that it stopped working

#

so i cant get my head around what went wrong

#

const {error, paymentOption} = await initPaymentSheet({ customerId: customer, customerEphemeralKeySecret: ephemeralKey, paymentIntentClientSecret: paymentIntent, customFlow: true, merchantDisplayName: ${COMPANY}.LTD, applePay: true, merchantCountryCode: 'US', style: 'alwaysDark', googlePay: true, testEnv: __DEV__, primaryButtonColor: '#635BFF', returnURL: 'stripe-example://stripe-redirect', defaultBillingDetails: userDetails, });

wild basin
#

What's the error message you're getting?

humble pawn
#

it gives no error

#

error is also undefined

#

i checked testing keys in server and they all ok

#

nothing was touched so dont know what went wrong

wild basin
#

Only want to double check this because this usually turns out to be the cause

humble pawn
#

hmm as far as i checked nope, i only updated our wallet side code not stripe method codes and this two are seperated, everything seems to be ok until "initPaymentSheet" function

wild basin
#

Ok. And that function in particular hasn't changed, right?

humble pawn
#

ya ๐Ÿ˜… , its weird

#

could it be something from the stripe dashboard ?

#

like allowing something or disabling something ?

wild basin
#

Hm shouldn't be

#

Let me look into some things

humble pawn
#

as u can see been trying

#

sure thanks

wild basin
#

Ah ok so last time it was working was Feb 23

humble pawn
#

ya

wild basin
#

So that's a bit longer of a window. No other updates in the past month?

humble pawn
#

this is test mode

#

this is prod mode

wild basin
#

Got it

pine tapir
#

๐Ÿ‘‹

#

If you just try to log a result do you see anything?

#

Like do const result = await initPaymentSheet()

humble pawn
#

hello, sure will try that

pine tapir
#

Also can you share more of your client side code?

humble pawn
#

interesting no error in the object

pine tapir
#

Hmm so that makes me think init is working fine

#

But you aren't seeing the payment sheet be presented?

humble pawn
#

yep nothing

pine tapir
#

Can you show me your whole relevant client-side code for Payment Sheet here?

#

Have you added a log prior to presentPaymentSheet?

#

And ensured that is firing?

humble pawn
#

let me put the code somewhere and share link here

#

is ok ?

pine tapir
#

Yep that works

humble pawn
#

check the initialisePaymentSheet on line 109

pine tapir
#

Hmm okay so you are initializing payment sheet on render but then waiting to actually present on a button press

#

So what happens on that button press?

#

Can you add a log right before presentPaymentSheet?

#

And also do the same as what I described above and assign that to one variable and log that?

humble pawn
#

when button is clicked it would show the payment sheet from stripe

pine tapir
#

Correct

#

But you are saying that isn't happening currently?

humble pawn
#

give me some minutes will get back

pine tapir
#

Mmmk, let me know if I can help

humble pawn
#

i am back, sorry was checking the flow of everything, ya initialize() is called from parent component and u can see initialisePaymentSheet() is called from inside initialize(), if all goes well choosePaymentOption() is then called at the top component too but for choosePaymentOption() to run i expect paymentMethod to have been provided from initialisePaymentSheet() function which means the presentPaymentSheet() from stripe will never be called cause initialisePaymentSheet() is failing

pine tapir
#

Okay hold on one sec let me check something

humble pawn
#

sure thanks

pine tapir
#

Can you give me a PaymentIntent ID that you are testing with as well actually?

humble pawn
#

sure

#

paymentIntent: pi_3MpHRlC2b2UXE1UE08KT2jpP_secret_6opA7TwYxLn0tJ5e8tDdCfD7w

pine tapir
#

Ah okay I see the issue. So with the custom flow you are only going to see paymentOption resolve on initPaymetnSheet if the Customer already has an attached PaymentMethod

#

You are using a Customer with no PaymentMethod

humble pawn
#

attached PaymentMethod, hmm is that the server side ? or its part of code i provided ?

pine tapir
#

So in this case you need to presentPaymentSheet to actually collect a PaymentMethod

#

Well there are a couple ways you can attach

wet patrolBOT
pine tapir
#

If you pass setup_future_usage on the PaymentIntent server-side then the first time through the flow the PaymentMethod will be saved to the Customer

humble pawn
#

like this?

pine tapir
#

You would use off_session

#

Or on_session if your customer will always be present when you create the Charge

humble pawn
#

oh so like this ?

pine tapir
#

I don't really understand your code though. Like the issue comes from
if (paymentMethod === undefined || paymentMethod === null) return;

#

Yes that would be correct

humble pawn
#

i added that caused i was expecting it to exist from initialisePaymentSheet() function

#

i guess can overlook it

pine tapir
#

Ah okay yeah if you remove that then it PaymentSheet should present properly on your button click when there is no saved PaymentMethod

humble pawn
#

i see, wouldnt have known that ๐Ÿคฃ

#

let me try now

#

ah works

pine tapir
#

Nice

humble pawn
#

let me remove off_session to see if works too

pine tapir
#

Yeah setup_future_usage won't have any real effect here the first time a customer goes through the flow

#

It is meant so that you save PaymentMethods and then they don't have to enter their details again the next time they go through the flow

humble pawn
#

also works and when you mean details, is it their card details or email and so on..?

#

or do u mean would automatically save the card ?

pine tapir
#

"details" = everything the PaymentSheet collects when you present it.

#

Mostly card details, but depends on the Payment Method Type

#

And then yes, it will automatically save the card to the Customer

humble pawn
#

i see, so best to use off_session then, right ?

pine tapir
#

So then next time when they go through the flow that card will be returned to you in initPaymentSheet and you can then show them the image for that card and then confirm that without them going through PaymentSheet again if you want.

humble pawn
#

i see, interesting

pine tapir
#

Yes off_session if you ever are going to charge the customer when they aren't actually in your app

humble pawn
#

thanks for the heads up, didnt know this before ๐Ÿ™Œ ๐Ÿคฃ

pine tapir
#

np!

humble pawn
#

i still have 3 more simple questions

pine tapir
#

Sure

humble pawn
#

what exactly is returnURL in initPaymentSheet ? if in an app does it open a page to the provided url ?

pine tapir
#

That is used for payment method types that require a redirect.

#

In that case your customer is redirected to their bank to authenticate the payment

#

After they authenticate they are returned to that returnURL

humble pawn
#

i see then i should provide main company url home page to the returnUrl ?

#

oh already have deeplinking

pine tapir
#

Great, then follow that doc that I provided to handle deep linking for these cases

humble pawn
#

i should just pass the deep link url of the payment page and stripe will direct back there ?

pine tapir
#

Yes but also you need to add some pieces to your code

#

See the above

#

For Android it will just work

#

But iOS you need to add stuff

humble pawn
#

ah i see, nice nice

#

thanks for this too

#

what is urlScheme ?

#

i remember just following the doc

pine tapir
humble pawn
#

dont get that, part of url?

sterile lark
#

๐Ÿ‘‹ Hopping in since bismarck has to head out

humble pawn
#

hello

#

dont get what is meant by part of url

sterile lark
#

The doc that bismark linked to has an example:
If you look at the URL slack://secret/magic-login/other-secret then the URL scheme would be "slack" (the first part before the ://)

humble pawn
#

aaahh i get it now

#

its just the start of the linking for the app

#

noted thanks

sterile lark
#

๐Ÿ‘

humble pawn
#

my last question, on the server side, if i want to add users name or address "await stripe.paymentIntents.create" do i just pass it ?

sterile lark
#

No, those are things you'd want to set on the Customer instead of on the PaymentIntent usually

humble pawn
#

ah i see

#

so how do i set the users name ?

sterile lark
humble pawn
#

hmm but this only when creating customer

#

what if they have changed their details ?

sterile lark
#

You can just update the Customer then

humble pawn
#

const customer = await stripe.customers.create({ email, name, });

#

is this correct ?

sterile lark
humble pawn
#

ah i see

#

thanks a lot

#

thats all my questions