#Nelsonct7

1 messages · Page 1 of 1 (latest)

edgy ploverBOT
craggy lodge
#

Hi there!

#

Can you clairify your question?

winged vessel
#

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

craggy lodge
winged vessel
#

ok, I just have to filter out the objects without invoice, thanks, man

craggy lodge
#

Happy to help 🙂

winged vessel
#

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

craggy lodge
#

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)?

winged vessel
#

this is what I am getting in test mode

craggy lodge
#

Can you share the PaymentIntent ID (pi_xxx)?

#

So it doesn't come from a subscription, which explains why invoice is null.

winged vessel
#

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 ?

craggy lodge
#

Correct

#

Test mode and live mode work the same way.

winged vessel
#

ok, thanks for your help.