#Kiranova
1 messages ยท Page 1 of 1 (latest)
I'm using Symfony (so the PHP way tho!)
๐ Thanks for reaching out
You can use this Stripe API in order to fetch the customer's subscription.
https://stripe.com/docs/api/subscriptions/list#list_subscriptions-customer
Once you find the last subscription you can refer to latest_invoice field which contains the last invoice/payment for that customer:
https://stripe.com/docs/api/subscriptions/object#subscription_object-latest_invoice
Thank you! But if he has no more subscriptions, I can't apply any methods on empty object...
Yes which means that the customer don't have any subscription.
Ok. so it is not possible de get his old subscriptions or old payments dates?
If he has no subscriptions at the moment
If you want just the last payment of a customer regardless if he has a subscription or not, you can use the PaymentIntent search API:
https://stripe.com/docs/api/payment_intents/search
And query filter by customerId:
https://stripe.com/docs/search#query-fields-for-payment-intents
It's weird because with the Stripe dashboard we can reach old subscriptions canceled or finished
Oh yes! That's what I was looking for! Thank you
Np!
Worked perfectly! Now I can send those payment dates to my marketing team! Thank you again, it's great to have someone to talk with for a API! Have a great day
Glad to hear that! have a great day too ๐