#lelouch
1 messages ยท Page 1 of 1 (latest)
Hello, everything was working well
both production and development
did a build run and then realized issue
Hm ok. You said everything was working. What did you change before everything broke?
Was it on an earlier version when it was working?
i changed nothing regarding stripe and yes i later updated Stripe from "0.23.3" to "0.26.0"
So everything worked on 0.23.3 and upgrading to 0.26.0 is what broke the app?
i dont think so, i noticed was not working in 0.23.3 then i made the update thinking maybe something went wrong
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, });
What's the error message you're getting?
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
Are you positive about this? Have you checked your version control for the code base to check for any modifications in the last few weeks?
Only want to double check this because this usually turns out to be the cause
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
Ok. And that function in particular hasn't changed, right?
ya ๐ , its weird
could it be something from the stripe dashboard ?
like allowing something or disabling something ?
Ah ok so last time it was working was Feb 23
ya
So that's a bit longer of a window. No other updates in the past month?
Got it
๐
If you just try to log a result do you see anything?
Like do const result = await initPaymentSheet()
hello, sure will try that
Also can you share more of your client side code?
Hmm so that makes me think init is working fine
But you aren't seeing the payment sheet be presented?
yep nothing
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?
Yep that works
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?
when button is clicked it would show the payment sheet from stripe
give me some minutes will get back
Mmmk, let me know if I can help
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
Okay hold on one sec let me check something
sure thanks
Can you give me a PaymentIntent ID that you are testing with as well actually?
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
attached PaymentMethod, hmm is that the server side ? or its part of code i provided ?
So in this case you need to presentPaymentSheet to actually collect a PaymentMethod
Well there are a couple ways you can attach
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
https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage is the parameter I'm talking about server-side
like this?
You would use off_session
Or on_session if your customer will always be present when you create the Charge
oh so like this ?
I don't really understand your code though. Like the issue comes from
if (paymentMethod === undefined || paymentMethod === null) return;
Yes that would be correct
i added that caused i was expecting it to exist from initialisePaymentSheet() function
i guess can overlook it
Ah okay yeah if you remove that then it PaymentSheet should present properly on your button click when there is no saved PaymentMethod
Nice
let me remove off_session to see if works too
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
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 ?
"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
i see, so best to use off_session then, right ?
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.
i see, interesting
Yes off_session if you ever are going to charge the customer when they aren't actually in your app
thanks for the heads up, didnt know this before ๐ ๐คฃ
np!
i still have 3 more simple questions
Sure
what exactly is returnURL in initPaymentSheet ? if in an app does it open a page to the provided url ?
That is used for payment method types that require a redirect.
Like bank redirects (https://stripe.com/docs/payments/bank-redirects)
In that case your customer is redirected to their bank to authenticate the payment
After they authenticate they are returned to that returnURL
If you are going to support these types of payment methods then I'd also recommend implementing deep linking to smoothly return them to your app: https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=payment-sheet#react-native-set-up-return-url
i see then i should provide main company url home page to the returnUrl ?
oh already have deeplinking
Great, then follow that doc that I provided to handle deep linking for these cases
i should just pass the deep link url of the payment page and stripe will direct back there ?
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
ah i see, nice nice
thanks for this too
what is urlScheme ?
i remember just following the doc
Part of the URL. See: https://reactnative.dev/docs/linking
dont get that, part of url?
๐ Hopping in since bismarck has to head out
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 ://)
๐
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 ?
No, those are things you'd want to set on the Customer instead of on the PaymentIntent usually
You should take a look at the Customer object - https://stripe.com/docs/api/customers/create#create_customer-name
You can just update the Customer then
No, that's creation - if you already have a Customer you'll want to update it (https://stripe.com/docs/api/customers/update)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.