#Nelsonct7
1 messages · Page 1 of 1 (latest)
hi, I have an array of payment intents with my customer, it is a collection of both products and subscriptions, I need to retrieve only the subscription pi_ intents from stripe acount
const stripe = require('stripe')('sk_test_your_key');
const paymentIntent = await stripe.paymentIntents.retrieve(
'pi_1Dstq32eZvKYlo2CShnP61Sg'
);
I have been using this method to retrieve the payment intents
If a PaymentIntent comes from a subscription, it will have an invoice property: https://stripe.com/docs/api/payment_intents/object#payment_intent_object-invoice
ok, I just have to filter out the objects without invoice, thanks, man
Happy to help 🙂
will there be invoice property for all intent object, and subscription has value in it, in my console all my intents are showing the invoice property, with null values. but in the list two of it is subscription and one is product,
@craggy lodge hi could you cleat it
I'm not sure I understand your question. If a PaymentIntent has a invoice property that is not null, then it was created by an invoice, which usually means it comes from a subscription (unless you also create one-off invoices).
Are you seeing a PaymentIntent with a null invoice that comes from a subscription? That shouldn't be possible. Can you share the PaymentIntent ID (pi_xxx)?
this is what I am getting in test mode
Can you share the PaymentIntent ID (pi_xxx)?
You created this PaymentIntent yourself with the request: https://dashboard.stripe.com/test/logs/req_kQ7jXn3ne0Kw6e
So it doesn't come from a subscription, which explains why invoice is null.
ok, thats how, so in future in live mode I just have to check for the invoice to distinguish the subscripions, it will work wont that ?
ok, thanks for your help.