#flux-pricingtable-free

1 messages · Page 1 of 1 (latest)

random prairieBOT
stark swift
#

flux-pricingtable-free

#

It's not possible today as far as I know, let me double check

#

yeah that is not available today sorry, I flagged as a feature request internally

loud basin
#

Will it be created?

stark swift
#

I flagged it to the product team, I can't tell you if/when we'll add support for it

loud basin
#

Alright, also how do I make it so when someone pays it doesnt keep creating a new customer in Stripe if they change their name?

strange sequoia
#

how are you currently collecting payment details? Are you using Checkout or Payment Element?

loud basin
#

Pricing Tables

#

Pretty sure checkout

strange sequoia
#

ah, sorry, missed that

loud basin
#

idk

#

I just know its a Pricing Table

strange sequoia
#

there's currently no way to prevent new customers from being created. If you want to continue to use Pricing Tables, the best you can go about it is to pass in the customer email, https://stripe.com/docs/no-code/pricing-table#customer-email. And then you can filter for the Customer by the email : https://stripe.com/docs/api/customers/list#list_customers-email, or for the Checkout Session via the Email : https://stripe.com/docs/api/checkout/sessions/list#list_checkout_sessions-customer_details

loud basin
#

Like this?

#
 const getCustomers = await stripe.customers.list({ email: `${req.user.email}` });

 if (getCustomers.data.email === `${req.user.email}`) {
                console.log(getCustomers)
                return res.redirect('/app')
            } else {
                const customer = await stripe.customers.create({
                    email: `${req.user.email}`,
                    name: `${req.user.username}#${req.user.discriminator}`,
                });
                return res.redirect('/accounts/get-started')
            }```
strange sequoia
#

can you explain what you're trying to achieve here?

loud basin
#

if customer is already in stripe, show their dashboard, else prompt them the pricing table

strange sequoia
#

stripe.customers.list is going to return an array, i don't think getCustomers.data.email will work

#

anyway, you should run it and see if it works for you

loud basin
#

I found a solution, but how do I redirect users back to the website when they pay from the pricing table

#

?

#

There is no back button, or anything.

strange sequoia
#

you mean from the hosted Checkout page?

loud basin
#

Yes.

strange sequoia
loud basin
#

Either I am seeing things, or would it be subscription.items.data.price.id?

#

I provided the request above.

strange sequoia
#

i don't understand the question? like what are you trying to do, what happened, what did you expect to happen instead?

loud basin
#

I'm trying to get the Price ID thats in the request above, but it keeps returning Cannot read properties of undefined (reading 'id')

strange sequoia
#

items.data is an array

#

to debug such issues, access each item step by step - for example : can you access subscription.items? can you access subscription.items.data? etc

#

it would probably be subscriptions.items.data[0].price.id

loud basin
#

I've got it working, thanks.