#ignasidedieu_api
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/1336663826333958194
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
- ignasidedieu_docs, 1 hour ago, 4 messages
To add more information, right now we are processing the "checkout.session.completed" event for this Payment Intent, however when we get latest charge object it returns null.
You'll need to retrieve the Payment Intent expand the latest_charge field. It's not included in the event payload by default
I retrieve the PaymentIntent, here is a piece of code "PaymentIntent paymentIntent = stripePaymentIntentService.retrievePaymentIntent(checkoutSession.getPaymentIntent(), requestOptions);", and then we're using paymentIntent.getLatestChargeObject(). According to the classe, it should check if there is a latestCharge and if so return the Charge object. public Charge getLatestChargeObject() {
return this.latestCharge != null ? (Charge)this.latestCharge.getExpanded() : null;
}
Are you expanding the latest_charge field? What does requestOptions look like?
According to our logs, the PaymentIntent object has this latest_charge id associated: "latest_charge": "ch_3Qp6mZLOFmVUUygj0mF7VDK2",
requestOptions only contains the accountId: acct_1NsnARLOFmVUUygj
Then you're not expanding the field in the API request: https://docs.stripe.com/api/expanding_objects?lang=java
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Sorry, how should we expand the "latest_charge" field? Shouldn't it be returned by .getLatestCharge() method? ๐
I think I got it, we should use the PaymentIntent retrieve method with expandable methods. PaymentIntent.retrieve(paymentIntentId, expandList, requestOptions);
Yep!
List<String> list= new ArrayList<>();
list.add("charge");
Map<String, Object> expandList= new HashMap<>();
params.put("expand", list);
Should it be like this?
Yes, but latest_charge