#nikivi

1 messages · Page 1 of 1 (latest)

lime laurelBOT
native ermine
#

You just want a list of customer emails that have at one point made a successful payment?

#

If so, why?

slender lichen
#
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

native ermine
#

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

#

Recommend storing data on your end with webhooks though to avoid these intensive api calls

slender lichen
#

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

native ermine
#

Most likely because webhooks are what we recommend for most things