#brunowilliang_code
1 messages ยท Page 1 of 1 (latest)
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- brunowilliang_code, 3 minutes ago, 25 messages
- brunowilliang_code, 17 hours ago, 3 messages
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1220682321326506055
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
@drifting rover
I got access, put it in an MD and separated the two endpoints it has...
Can I share it here?
Note it's a public forum.
As long as it doesn't contain any API keys it should be ok.
What, it doesn't contain any keys
I can share the code that is also working in the Kotlin application
const payObj = await stripe.paymentIntents.capture(intent);
This line tries to capture the PaymentIntent.
right
I don't know how else is this code supposed to be used, but if you are not aiming to capture the payments manually, this line shouldn't be there.
And once again, please use webhooks for your business logic if you don't want to loose any data: https://stripe.com/docs/webhooks
So, since the api is already ready, I'm just moving the app from Kotlin to React Native
Maybe the PaymentIntents used in Kotlin app actually required manual capture? https://support.stripe.com/questions/using-authorization-and-capture-with-paymentintents
I don't think we need that right now. What exactly is blocking at the moment?
it's trivial to do
let pi = await stripe.paymentIntents.retrieve(intent)
if(pi.status === "requires_capture"){
pi = await stripe.paymentIntents.capture(intent)
}
so I'm sort of lost here.
I assume you saw/understood this reply from my colleague yesterday?
I'm unclear what else we can explain here but please let me know what's unclear.
so the old application code is working passing through the /terminal/capture endpoint
but not mine in react native it doesn't work
basically this
I mean let's ignore that
you say
The PaymentIntent has already been confirmed and marked as 'succeeded', but the capture log fails with a 400 status: 'PaymentIntent already captured'.
, you've said that multiple times
Do you want to see the payment flow of the old app in Kotlin?
that is 100% expected to get that error
don't call .capture if the status is succeeded; it only makes sense to call it if the status is requires_capture , and that can be trivially checked via something like the snippet I posted above. If the status is succeeded, then the payment is already captured and you can skip to the next part of the logic.
that's it really! can I clarify that in any way?
I don't know if I understand, I'll only call capturePayment if confirmedPaymentIntent.status === 'requiresCapture'
right?
right
one second, I'll try
another question, do I need to pass capturePayment to go to the database
right?
I don't know what that question means, sorry.
sorry I still don't understand what specifically you're asking me about Stripe/its API/SDK, you just pasted a bunch of code from your own app.
ok, I'll explain once again, I have an Android application working perfectly for payment...
I'm moving this android application to react native...
yep I understand all that
any updates from this?
one second
in the android app it uses capturePayment to capture the payment
and capturePaymentLog to capture the error
and in my react native application I do the same thing and get an error
That's what I don't understand
and we've explained why โ the PaymentIntent is already captured when you call it
what's probably different is the capture_method you set on the PaymentIntent is now automatic but in your previous codebase it was manual
https://support.stripe.com/questions/using-authorization-and-capture-with-paymentintents
https://docs.stripe.com/api/payment_intents/create#create_payment_intent-capture_method
you can check that and look at the code where you create the PaymentIntent.
So why does it generate logs in stripe, but not in my database?
I'm not sure what that means sorry
I don't know how I can explain more
the logs in stripe are generated... but in my database they are not
show me an example of what a "log in stripe" is.
I can't tell you why something does or does not exist in your database, that is your code and your logic you developed
I'm more than happy to help you troubleshoot the part of your code that might have some bugs with handling the results from the Stripe API and that's what I've tried to clearly explain above(checking the status before calling the capture API; explaining how capture_method is involved and how you control that in the API call you make to create the PaymentIntent)
that's a webhook event yep, those happen whenever you call the API or something happens on your account.
you can also see on line 17 that capture_method is automatic
which is exactly what I was explaining to you earlier:
what's probably different is the capture_method you set on the PaymentIntent is now automatic but in your previous codebase it was manual
https://support.stripe.com/questions/using-authorization-and-capture-with-paymentintents
https://docs.stripe.com/api/payment_intents/create#create_payment_intent-capture_method
do you understand?
So do I have to go through the manual?
captureMethod: 'manual',
- you can change your code that creates the PaymentIntent in the new codebase so you explicitly pass
capture_method:'manual'so that you have the behaviour of the old codebase - you can adjust the logic for your capture function to check the status before trying the capture API call(what I explained earlier) so that it works regardless of what
capture_methodthe PI is using
either works
one seocnd
By passing captureMethod: 'manual' I was able to call the capturePayment function
yeah like I said, that's one of the approaches that would work
I'm just going to check if the logs arrived
one second
It's workinggggggg
omg
thank yo
Thank you very much, everything worked fine here
great!