#AlienSoft
1 messages ยท Page 1 of 1 (latest)
Hi there
Hi
You are looking for the total number of Customers on your account?
yes
Sigma is likely going to be the easiest thing for this.
sigma?
Otherwise you need to just list Customers using the API
Err actually you can likely just export this from your Dashboard
Yeah that is going to be easiest
whoa sigma seems cool... but i need this done in php ( as in not manually me finding it out)
basically after a successful payment, I need to get no of customers to generate an Invoice NO
so like a unique serialized no
Gotcha well to get the current amount I'd just export from your Dashboard, then you will want to ingest data going forward either using Webhooks or listing via the API
Hmm we already provide you an Invoice number
And why does that Invoice number need to be related to number of Customers?
You just want a UUID no?
well, i just need a serialized number that is incremented on each purchase
and i though number of customers is the way forward
Hmm yeah that seems like a lot more work than you need. Just track your own number in your database. No real need to involve number of Customers at all
(cos i'm creating a custom invoice) rather than having one generated from stripe
i don't really have a database.. that's the thing ๐
perhaps the customer object can show/pull no of customers right ?
No we don't aggregate the number of Customers you have in the API
๐ฎ
You can store this data via metadata on a Customer though
So whenever you create a Customer just set corresponding metadata for how you want the Invoice numbering to work
well even as metadata i still need to keep track of it to increment the metadata
the idea is for me not to have an sql table with all customers
then pull data from there
i thought i can just do that through stripe/customers
can't i just enumerate all customers ?
for each user in customers.....
Not sure what you mean exactly?
basically run a loop to pull all customers
then i can just increment the variable in the loop and we'll have total customers
Sure but you don't want to do that every single time
Like you can definitely do that once and then set corresponding metadata if you want and then go that route
isn't there something else internal that tracks/increments on each payment?
My recommendation would be to just create a system where you set metadata on the Customer as the "prefix" and increment that Metadata when you create a new Customer. Then set metadata on each PaymentIntent using that "prefix" and a "suffix" for the Invoice number which you increment each time on a per-customer basis for each PaymentIntent.
No we don't really increment anything for you on one-off payments
but even with your recommendation somehow we still need to pull the data from somewhere to set the METADATA ๐
i/e say person a made a purchase. that's meta1
when customer 2 comes, how do i know i'm on meta1
to increase it to meta2
You list your Customers
And look at the most recent Customer
Overall this isn't foolproof. You can run into a race condition here
Really you should have your own database and not use Stripe as a database here for your own custom invoices
that's what i mentioned earlier ๐ but you said: "Sure but you don't want to do that every single time"
I was under the impression you meant you were going to loop through all of your customers each time instead of setting metadata and doing one list request
Apologies if that was lost in translation ๐
pfff im starting to rethink the whole process now!
having a database just for incrementing purposes would be silly.
why have a separate database of customers when stripe already provides that ๐
There are many reasons you would want a database really. You are going to run into many future concerns/desires that having your own database would solve. Our API is not meant to work as a database and is going to be limiting in terms of working with your data overall.
that just means a total redesign from my end. to have to populate a database, then pull info from there to populate invoice..etc etc..
If you don't want to do that then you should go the metadata route and use that metadata as your "database" and check against it.
There isn't really another way here as far as I know.
๐