#Vortixz
1 messages · Page 1 of 1 (latest)
Can you tell me more about what you are trying to figure out at the moment? I can see if my colleagues who are more knowledgable there are online but it will be helpful to ask specific questions when seeing if they can help now
Yes i'll try to explain it. So the firebase extension basically listens for me to write a document to the database. Then it immediatly appends more values to that document, for example the paymentIntentClientSecret. Now when the page renders for the first time it does this. But i'm stuck with getting the new values back.
I'm thinking of using the firebase onSnapshot method but this method also listens to the creation of the document but I want it to only listen to the update. I'm looking for a certain flow which ensures that I'm always getting the updated values back (to prevent empty client secrets etc.)
Gotcha, thanks for the clarification. Reaching out to my colleagues to see if they are online. Otherwise you can open a ticket with us and they can get to it when they are in
thank you very much
Hey, stepping in here. Can you confirm which extension you're using? https://github.com/stripe/stripe-firebase-extensions
hey, yeah thats stripe/firestore-stripe-payments@0.3.2
And you're calling the createCheckoutSession function? What params do you pass?
no im not i followed partly this documentation https://stripe.com/docs/payments/accept-a-payment?platform=react-native
i'll show you how i've done it
Please do
i tweaked a lot of this code and im trying to rework it so it might not be 100% correct but it wasn't in the first place. it's just to show the idea
this code was executed on the first render. it gets it values from the following method
I'm more interested in your server-side function that creates those params for the Payment Sheet
so i made the document and the i'd map through the checkout_sessions collection and get the 0'th index which is bad because
i dont have any code for that. its what the extention does
what i would essentially want is make the document, and listen to the update that the extension performs. and then retrieve these added values and call initPaymentSheet with it
as explained here
You need to 'listen' to updates on the document reference you're creating, with onSnapshot. This is really more of a Firebase Q than anything specific to Stripe. See: https://firebase.google.com/docs/firestore/query-data/listen#web-version-9
yea you're right it really is more of a firebase Q but i was hoping that someone was experienced with the extension and firebase
onSnapshot also triggers when the document gets created
I am experienced with the extension, I help maintain it to an extent. But you aren't really using the extension
You're creating your documents directly, as opposed to using the createCheckoutSession the extension exposes
Which should handle this
i haven't read about this method
there's nothing about the createCheckoutSession there. And this is basically what the extension does. By adding a document to the firestore it creates a checkout session
the extension listens to the created document and appends credentials like the payment intent client secret. i only need to fetch that updated document
using onsnapshot would also trigger when I make the document, so its not certain that the extension has already added the new values
You can filter changes by type from the snapshot: https://firebase.google.com/docs/firestore/query-data/listen#view_changes_between_snapshots
I guess you'd want a modified type in this instance
YES that's it. I must have read over this
can you help me implement this code using the initPaymentSheet or is that not possible?
I can try help with any specific issues you encounter, I can't write code for you
I completely understand, I assume those issues should be directly associated with Stripe?
Not sure what you mean
Let's say I'm having issues with getting the values from the onSnapShot into the initPayment() is that something you could assist me with. Or only if the issue is related to Stripe
As I said, I can try. But you need to try and implement it yourself at least and come back with any specific issues/errors
Okay ill do that. Thank you for your help!
Hey, i managed to make it work using relatively few code and personally i think it's a really clean way of setting up Stripe's payment sheet using RN and the FB extension. It would've really helped me if there would've been a little more documentation regarding this.\
I'll share the code in case you'd like to take a look
Feel free to open a PR on the repository if you think the documentation can be improved! I'd be happy to take a look
Glad to hear you're unblocked 🎉
Looks good!