ComponentsButton Account

A button with a dropdown menu to manage user account:

  • Billing: Open a Stripe Customer Portal to manage their billing (cancel subscription, update payment method, etc.). You have to manually activate the Customer Portal in your Stripe Dashboard. This is only available if the customer has a customerId (they made a purchase previously).
  • Logout: sign out the user and go back to the homepage

It's automatically hidden if the user is not logged in. This component is used to handle Stripe or Lemon Squeezy subscriptions and one-time payments.

Button Account Component

/app/dashboard/page.tsx

1import ButtonAccount from "@/components/ButtonAccount";
2
3export const dynamic = "force-dynamic";
4
5export default async function Dashboard() {
6  return (
7    <main>
8      <section>
9	      ...
10        <ButtonAccount />
11        ...
12      </section>
13    </main>
14  );
15}