#bruhhhhh_invoice-paymentintent-lookups
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/1397702840260100206
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi! What info / ID type are you starting the search with?
i'm starting with payment intent ID and charge ID respectively for the two logic paths specified above
i want an implementation of the two logic flows without having to loop through all invoice objects. ideally, i want the most performant implementation possible.
Hi ๐
I'm taking over as my colleague needs to go
You can get to the Invoice without paginating through the List Invoice API
In both cases you will need the Payment Intent ID but you can find this in the payment_intent property on the Charge object.
i'm a bit confused on how to can get to a unique invoice based on a Payment Intent Id
Okay that SDK version is pinned 2025-03-31.basil
Just making sure because, prior to the .basil release, the answer was different. But this works
just to double confirm. my NodeJS SDK version is Node.js SDK 18.0.0 โข Basil. are you saying there is a way to get to a Stripe Invoice object from a Stripe Payment Intent object?
So
- Get the Payment Intent ID
- Use the Payment Intent ID to filter the List Invoice Payments API
- Get the Invoice ID from the Invoice Payment record
- Retrieve the Invoice Object from the API using that ID
The issue you are having is that as of the .basil API changes, specifically this one, we no longer have a direct link between Payment Intents and Invoices.
The way you find what Invoice a Payment Intent is related to is through the Invoice Payments object.
gotcha, let me try this and get back to you. thanks!
i might potentially get back to you tmr depending on how quickly i'm able to verify this hypothesis
No worries! Someone will be here when you a follow up or new question.
thank you!
Happy to help ๐
does the Stripe NodeJS sdk support filtering simultaneously while listing invoices?
If you are referring to filtering the Invoice Payments, you pass the Payment Intent ID as a parameter in the List API.
If you're talking about something else, could you share more details?
i think that answers your question for now! thanks!
Great! ๐
in the PaymentIntent doc (https://docs.stripe.com/api/invoice-payment/list?lang=node&api-version=2025-03-31.basil), is payment.payment_intent the payment_intent id?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yeah, that wording could be more clear
In Python (my โค๏ธ language), it looks like
invoice_payments = stripe.InvoicePayment.list(
payment= {
"type": "payment_intent",
"payment_intent": "pi_XXXXXXXXX" # <- this is where you put the ID
}
)
hmm i'm trying the following curl, but it's not working for me
curl "https://api.stripe.com/v1/invoice_payments" \ -u "sk_lMP:" \ -H "Stripe-Account: acct_1P08oKEcXPR7OoBw" \ -G \ -d limit=10 \ -d data.payment_intent='pi_3Ro0sdEcXPR7OoBw01Oz0NVO' \ -d "expand[]=data.payment"
What does the API response look like?
{
"error": {
"code": "parameter_unknown",
"doc_url": "https://stripe.com/docs/error-codes/parameter-unknown",
"message": "Received unknown parameter: payment_intent",
"param": "payment_intent",
"request_log_url": "https://dashboard.stripe.com/acct_1P08oKEcXPR7OoBw/logs/req_IHk8e8iRcj6SEC?t=1753312074",
"type": "invalid_request_error"
}
Okay yeah you aren't passing the parameter correctly. You are just putting payment_intent: pi_XXXX.
You need to provide the entire payment parameter. This includes a nested payment.payment_intent as well as payment.type
It's what I did in my Python example above, but with JavaScript object syntax
oh interesting
I think in Node it would look something like this:
const invoicePayments = await stripe.invoicePayments.list({
invoice: 'in_103Q0w2eZvKYlo2C5PYwf6Wf',
payment: {type: "payment_intent", payment_intent: "pi_XXXXXXXXXXX"}
});
when i try
curl "https://api.stripe.com/v1/payment_intents" \
-u "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:" \
-H "Stripe-Account: acct_1P08oKEcXPR7OoBw" \
-G \
-d limit=10 \
-d payment_intent=pi_3Ro0sdEcXPR7OoBw01Oz0NVO \
-d type=payment_intent \
-d "expand[]=data.payment"
```,
I'm getting
{
"error": {
"message": "This property cannot be expanded (data.payment).",
"request_log_url": "https://dashboard.stripe.com/acct_1P08oKEcXPR7OoBw/logs/req_tP2rqbWRI4w9Og?t=1753313067",
"type": "invalid_request_error"
}
}
Your CURL request is still wrong
You aren't passing the nested payment parameter. I think it should look something like this:
curl "https://api.stripe.com/v1/payment_intents" \
-u "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:" \
-H "Stripe-Account: acct_1P08oKEcXPR7OoBw" \
-G \
-d limit=10 \
-d payment[payment_intent]=pi_3Ro0sdEcXPR7OoBw01Oz0NVO \
-d payment[type]=payment_intent \
-d "expand[]=data.payment"
And you cannot expand the payment property
You are retrieving the Invoice Payment object The only expandable property is the Invoice
gotcha thanks!