Skip to content

Commit

Permalink
make it so that user can buy multiples of the same product
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewwong525 committed Mar 3, 2024
1 parent 0b620bf commit f077fbc
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions supabase/functions/get_stripe_url/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ clientRequestHandler(async (req, user) => {
user.id,
).maybeSingle();
let stripeCustomerId = data?.stripe_customer_id;
const activeProducts: string[] = data?.active_products || [];
if (!stripeCustomerId) {
// create stripe customer if doesn't exist
const customer = await stripe.customers.create({
Expand All @@ -35,7 +34,7 @@ clientRequestHandler(async (req, user) => {

// check if user paid for product
const priceObj = price ? await stripe.prices.retrieve(price) : null;
if (priceObj === null || activeProducts.includes(priceObj.product)) {
if (priceObj === null) {
// open billing portal if product/subscription has been purchased
// or if price is null
event = "user opens billing portal";
Expand Down

0 comments on commit f077fbc

Please sign in to comment.