Skip to content

Commit

Permalink
🐛 (billing) Only fetch active subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed May 5, 2023
1 parent 8b3a690 commit 98a21f3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/builder/src/features/billing/api/getSubscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const getSubscription = authenticatedProcedure
const subscriptions = await stripe.subscriptions.list({
customer: workspace.stripeId,
limit: 1,
status: 'active',
})

const subscription = subscriptions?.data.shift()
Expand Down
2 changes: 2 additions & 0 deletions apps/builder/src/features/billing/api/updateSubscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ export const updateSubscription = authenticatedProcedure
})
const { data } = await stripe.subscriptions.list({
customer: workspace.stripeId,
limit: 1,
status: 'active',
})
const subscription = data[0] as Stripe.Subscription | undefined
const currentPlanItemId = subscription?.items.data.find((item) =>
Expand Down
2 changes: 2 additions & 0 deletions apps/builder/src/test/utils/databaseActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ export const cancelSubscription = async (stripeId: string) => {
const currentSubscriptionId = (
await stripe.subscriptions.list({
customer: stripeId,
limit: 1,
status: 'active',
})
).data.shift()?.id
if (currentSubscriptionId)
Expand Down

4 comments on commit 98a21f3

@vercel
Copy link

@vercel vercel bot commented on 98a21f3 May 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./apps/docs

docs-git-main-typebot-io.vercel.app
docs.typebot.io
docs-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 98a21f3 May 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

viewer-v2 – ./apps/viewer

bii.bj
1stop.au
yobot.me
klujo.com
me.cr8.ai
wachat.io
wassep.io
247987.com
8jours.top
aginap.com
ai.mprs.in
bee.cr8.ai
bot.aws.bj
bot.bbc.bj
cat.cr8.ai
finplex.be
nepkit.com
pig.cr8.ai
sat.cr8.ai
wachap.app
wachats.me
wsapio.com
bot.aipr.kr
bot.joof.it
bull.cr8.ai
docs.cr8.ai
minipost.uk
mole.cr8.ai
team.cr8.ai
wolf.cr8.ai
ai.meant.com
bot.grace.bj
cinecorn.com
help.taxt.co
kusamint.com
rhino.cr8.ai
sheep.cr8.ai
snake.cr8.ai
svhm.mprs.in
tiger.cr8.ai
video.cr8.ai
yoda.riku.ai
zebra.cr8.ai
bergamo.store
bot.krdfy.com
bot.tvbeat.it
cgcassets.com
cnvhub.com.br
facelabko.com
filmylogy.com
chat.webisharp.com
dicanatural.online
digitalhelp.com.au
goalsettingbot.com
noticiasnet.online
pant.maxbot.com.br
pantherview.cr8.ai
positivobra.com.br
rollingball.cr8.ai
survey.digienge.io
this-is-a-test.com
zap.techadviser.in
ai.digitaldaftar.in
bot.boston-voip.com
bot.cabinpromos.com
bot.carnaval.studio
bot.digitalbled.com
bot.dsignagency.com
bot.eventhub.com.au
bot.jepierre.com.br
bot.leadgenpod.site
bot.ltmidias.com.br
bot.viralsangat.com
bot.winglabs.com.br
carsalesenquiry.com
chat.marius.digital
chat.sr7digital.com
chatbot.matthesv.de
chatbot.repplai.com
demo.botscientis.us
demo.wemakebots.xyz
hrbot.robomotion.io
inearephones.cr8.ai
kbsub.wpwakanda.com
limitenahora.com.br
live.botscientis.us
mentoria.omelhor.vc
nutrisamirbayde.com
order.maitempah.com
profileadscloud.com
quest.wpwakanda.com
support.wawplus.com
survey1.digienge.io
surveys.essiell.com
test.botscientis.us
test.getreview.help
test.reventepro.com
typebot.stillio.com
wordsandimagery.com
88584434.therpm.club

@vercel
Copy link

@vercel vercel bot commented on 98a21f3 May 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 98a21f3 May 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-typebot-io.vercel.app
app.typebot.io
builder-v2-git-main-typebot-io.vercel.app

Please sign in to comment.