#chris-customer-previouspayments
1 messages ยท Page 1 of 1 (latest)
Almost like being able to find out if a "first time only" promo code would be accepted/valid or not.
If you're using Customers you can list all payment intents given a customer ID (https://stripe.com/docs/api/payment_intents/list#list_payment_intents-customer) to confirm whether they've made any previous transactions or not
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
So if there were payment intents created, I'd have to loop through the statuses to verify that they were completed, correct?
And since free trial subscriptions don't create payment intents, would that be [mean also] getting a list of those, including subscriptions and subscription items that were left incomplete, checking all those statuses?
I was hoping for a less intense way to do it because of the number of times that would come up in the designs I'm having to follow.
Yeah you'd have to loop through all the statuses unfortunately ๐ฆ
Backing up for a second though - are you solely using Invoices to accept payment from your customers? If so, you could use the list invoices api instead which should also allow you to filter by status (https://stripe.com/docs/api/invoices/list)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Hmmm... I can look in to that. I've gone as far as looking at the 'retrieve upcoming invoices' and not any further with the invoices API.
My fantasy solution was that since there's functionality in the promo codes for first time purchase only, that there might be something accessible (and that I missed in the docs) where I could query the customer info in some way to essentially get a boolean back to say whether it's a first time purchase or not.
Thank you for the different direction to look at, I'll give it a shot. I knew that I may have to make several calls to Stripe APIs and filter the responses to get that boolean and if that's the case, I'll just have to make it work.
The kicker is the whole "they had a free trial and cancelled, they don't get another"
Yeah you could try some combination of using retrieve upcoming invoices w/ a first time promo code to see if the code was applied, but you'd have to worry about a lot of specific edge cases that would make it hard to build right
Yeah, I've got some moving goalposts so I'm trying to find some way to get the required info without several calls to the Stripe APIs and processing the data because there's other design considerations that are already slowing down the interface. Hell, I'd be using Checkout if I could customise all the CSS easily and that would remove most of my problems.
I really appreciate your time and expertise. I'll figure something out until my requirements change next.
Have a great day ๐
๐ happy to help - one thing that may also be a good idea. Instead of listing all invoice/payments for a customer you can update the Customer with metadata as soon as they make the first "payment". That way when you check the customer in the future you can just check what metadata they have set instead of relisting all their past payments
I feel like an idiot. I forgot about updating the metadata. I sent up the 'ladder' that a boolean in our user table would do the trick and got a resounding "NO! We want the proper information from Stripe at every check!" so the processing is something that my brain was stuck on. The metadata is something I'm going to have to keep in my back pocket (if the processsing doesn't work out) as a way to do it without altering our users table. Thank you.
Might also be useful to know in future that you can use the Search API on supported objects to search metadata: https://stripe.com/docs/search
(including customers)