Handling platform subscription related events

Поделиться
HTML-код
  • Опубликовано: 1 окт 2024

Комментарии • 11

  • @TazBo-wd2ig
    @TazBo-wd2ig 10 месяцев назад

    Hi,
    I have a web app which has features in two different membership plans. The premium plan allows access to all areas and the free is restricted. When users sign up I want them on the premium plan for 60 days then downgraded if they don’t pay the subscription. My question is what do code do I need to add on certain parts of the website which’s check what plan the user is on and does that show the user a message of some sort saying please click here to upgrade your plan to access this area. Also how do I downgrade automatically? Thanks.

    • @StripeDev
      @StripeDev  10 месяцев назад

      Hi Taz-for automatically downgrading a premium trial when a user chooses not to subscribe, you can consider configuring a free trial: stripe.com/docs/payments/checkout/free-trials. For your other question, can you specify what you mean by certain parts of the website?

    • @TazBo-wd2ig
      @TazBo-wd2ig 10 месяцев назад

      @@StripeDev my web app has a section where there is a tool for searching cars but I want that for premium members only. When users land on that page if they are not premium they need to see a message saying you need to upgrade to see this page. But what code goes on that page to check if user is premium or not?

    • @StripeDev
      @StripeDev  10 месяцев назад

      If you want to to figure out whether a customer has an active subscription for a certain price/plan you can use
      stripe.com/docs/api/subscriptions/list, and filter 'customer' and 'price' and 'status'.

  • @RodrigoNeves-f9x
    @RodrigoNeves-f9x 10 месяцев назад

    How to handle a future invoice failed for any reason

    • @StripeDev
      @StripeDev  10 месяцев назад

      Hi Rodrigo-we have some documentation on how to handle failures: stripe.com/docs/declines#responding-to-failures-api.

  • @brucewayne2480
    @brucewayne2480 Год назад

    I noticed that "subscription.updated" is also fired at the same time with "subscription.created" or "checkout.session.completed" and give almost the same information , why should I handle both since they will make a lot of db requests at the same time ?
    Thank you

    • @StripeDev
      @StripeDev  Год назад +1

      Hi there-if you're using Checkout, then the best option would be to use [checkout.session.completed]. This doc has more info: stripe.com/docs/payments/checkout/fulfill-orders.
      However, if you're using Subscriptions, you're going to need to listen to [customer.subscription.updated] and other Event types to handle future payments. This doc has more info: stripe.com/docs/billing/subscriptions/webhooks#events.

    • @brucewayne2480
      @brucewayne2480 Год назад

      @@StripeDev
      Thanks for the answer. I'm using checkout and subscriptions just like the video (SAAS product) but I noticed that subscription.updated is firing when a new subscription is created so why not using only that event instead of using subscription.updated and checkout.session.completed that are firing at the same time

    • @StripeDev
      @StripeDev  Год назад

      Great question-we'd like to gather some more info and help you with this through our email support channel. Please open a ticket with us using this link: support.stripe.com/questions/contact-stripe-support. Thank you!

    • @Benjamin-Chavez
      @Benjamin-Chavez 10 месяцев назад

      @@brucewayne2480Did you get an answer to this?