#nikivi
1 messages · Page 1 of 1 (latest)
You just want a list of customer emails that have at one point made a successful payment?
If so, why?
app.post("/check-wiki-bought", async (c: Context) => {
const data = await c.req.json()
// TODO: do call to stripe for this list!
const paidEmails = [""]
i have this endpoint
i currently do it manually
i want to get the list from stripe
if (paidEmails.includes(data.email)) {
return c.json({ paid: true })
}
it basically given an email, returns if the email has paid or not
There's not a very efficient way to do this via the api, but it is possible. You would need to filter customers by email: https://stripe.com/docs/api/customers/list#list_customers-email then with that list filter payment intents by the resulting customer id's to check: https://stripe.com/docs/api/payment_intents/list#list_payment_intents-customer
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Recommend storing data on your end with webhooks though to avoid these intensive api calls
ah was afraid that'd be the case
seems like a common use case though
and stripe has been in operation for years
strange they did not think of it
Most likely because webhooks are what we recommend for most things