#andre-sourcetransaction-charge
1 messages · Page 1 of 1 (latest)
andre-sourcetransaction-charge
@tawny spindle a PaymentIntent has the latest_charge property so you can use that
so the latest charge gives me the charge id that I need to create a transfer?
if that PaymentIntent is in status: 'succeeded' then yes
I just found a bit weird that I only got the error through a try catch method, but I couldn't find the details of that attempt of transfer creation anywhere else. But this is just because I was not passing the correct charge id probably, right?
Yeah it's what we call an "invalid request error". I assumed you passed source_transaction: 'pi_123' and it said "No such charge: pi_123"
Got it! So I just tried that with this code:
const transfer = await stripe.transfers.create({
amount: amount * 100,
currency: 'brl',
destination: accountId,
source_transaction: paymentIntent.latest_charge,
});
I retrieved the payment intent and to access the lastest_charge parameters, but I'm still getting the same error (the status of the payment intent is succeeded)
Then I need more details than "the same error". I need to see an exact request so that I can look at it. In the error response there should be a req_123 somewhere (in a dashboard_url property)
Right! So this is the request for creating a transfer
This iswhere that payment intent id came from
those are pictures
I just want a req_123 that you get back in the API response when the call fails
or the PaymentIntent id pi_123 in text here, so that I can look up your logs and figure out what's wrong
okay so look at your logs in the Dashboard https://dashboard.stripe.com/logs you are not passing any source_transaction right now
so really add clear logs to your log, checkout what paymentIntent.latest_charge returns for example and log the exact response/error too
Got it! Will do that! Thank you very much for your help and time! It was really helpful
Unfortunately I gotta go do some other businesses rn, but will come back in a few hours
sounds good
So I'll try it again and if I get the error again, I'll reach u guys here again