#ryan_paymentintent-latest_charge
1 messages ยท Page 1 of 1 (latest)
๐ 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/1241123665047851170
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
This has moved to latest_charge in newer API versions and is not expanded by default, and newer versions of stripe-node now pin to specific API versions
You can get this data by using expansion to get the latest_charge object
expand[]=latest_charge
I totally missed that field on the payment intent. Thanks for pointing it out. Thanks!
Can I cause the payment intent in the response to be expanded when I create it? paymentIntents.create() that doesn't seem to be working.
Misplaced the expand option. Working out
Yep, that should be working. Let me kow if you have any toruble.
I just misplaced the parameter. I see the latest charge being expanded now. The code also expects a transferId to be a part of the charge, but I don't see a field for it. I see transfer related data, but no transfer id. Did this get moved as well?
The code also expects a transferId to be a part of the charge, but I don't see a field for it.
Can you share the code in question?
And an example charge?
Do you mean an example charge using the old API version?
I mean the code you're looking at that isn't working like you expect, along with an example charge you're trying to process
Or share more about what you're trying to do
Are you trying to inspect an attribute, or set a parameter?
I'm trying to get an attribute from the resulting payment intent. The original code (which I inherit) it attempting to access it with paymentIntent.charges.data[0].transfer but this is no longer valid. It is expecting that that attribute contains something like tr_1GaakiB1mmvuUMtBjXq8ydl7
ryan_paymentintent-latest_charge
@exotic arrow this all still exists but you have to use expansion like my colleague explained
Now, Im getting the latest charge, but I don't see an equivalent for transfer
Yes, I am getting the latest charge as synthrider explained. Now I'm trying to track down a piece of data in the response that I can't find
You used to get charges as an array of Charge objects right?
Now you get latest_charge: 'ch_123' as a string. But with expansion you can turn it into a full Charge object and if you do you can do payment_intent.latest_charge.transfer as expected
Except that the charge Im getting does not have a transfer field
Can you share exact ids?
looking
hum this... shouldn't be possible. Like my quick read is that you use Destination Charges on PaymentIntent and set transfer_data. This means we should be sending funds as a result of that Charge after it succeeds. The PaymentIntent and the Charge are clearly in status: 'succeeded' but the Transfer didn't happen.
Looking into why
Thanks.
I see you are using capture_method: 'automatic_async' which defers the real capture to later but it's supposed to be a few minutes not 30+
Let me see i I can track that down. Im not super familiar with this code
it doesn't look like we are explicitly specifying capture method.
Okay I looked at the Charge internally and it's definitely captured with a Transfer
ok
Where did you get that Charge object from? Did you maybe extract it from the charge.succeeded Event?
I got it from the response to paymentIntents.update with expand ste to have latest_charge
Sure but when does that Update happen? It likely happened before the Charge was captured by our async systems
Is that automatic_async parameter a default? I dont see us specifying it anywhere
did you maybe upgrade your API version and/or SDK without realizing there were breaking changes?
That is the case. They started off at v8 not too long ago and I'm trying to get them on the latest, but there are a lot of changes betwen 8 and 15
Looks like i need to read about the capture methods and specify one to suite our needs
gotcha so yeah you want to read the migration guides, a lot has changed
My gut tells me you want to keep the new default behaviour, it's much better for latency. You'll get the Transfer async with the charge.updated and/or transfer.created Event
We are not hooked up to receive events at all. There are no webhooks configured
But Ill take your advice under advisement
If your existing code uses a certain API version you can also force the SDK to use that API version and keep the old behaviour: https://docs.stripe.com/api/versioning
I think its alrady doing that.
I think its using the api version 2020-08-27
Are there older API versions you can't pin to?
Gotcha, so there's a bug in your code somewhere. You didn't pin the API version properly at least for the PaymentIntent creation, that's why you got capture_method: 'automatic_async'
See https://dashboard.stripe.com/test/logs/req_sjOwWssuoHpO6m which is your API request and it has the latest API version
it's not a parameter it's a separate initialization option, see https://docs.stripe.com/api/versioning
sorry, thats what I mean. The spelling of that seems to have changed unless the original authors of my code had a bug
They were using stripe-version
I don't think we changed this, I looked at all our migration guides and it's not mentioned. What's possible is that this never worked though and you got lucky that it used your default API version on your account
What we did change is that our SDKs now always pin the latest SDK version by default. So now we force that 2024 version until you override it, and maybe your override never worked
That's quite possible. Thanks for all your help. Ill reach out if I need anything more.
Have a good weekend
sure thing!