Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Documentation on : how to protect page with specific Stripe Subscription #1041

Open
KazeroG opened this issue Feb 17, 2024 · 0 comments
Open

Comments

@KazeroG
Copy link

KazeroG commented Feb 17, 2024

For now even with the subscription added and user registered but nothing is protected

So we should ...

Documenting the process of protecting a page with a Stripe Subscription is essential for several reasons:

Clarity and Accessibility: Documentation serves as a clear guide for developers and non-developers alike, ensuring that everyone involved in the project understands how the Stripe Subscription integration works and how it's used to protect content. This reduces confusion and helps new team members get up to speed quickly.

Best Practices: It promotes the adoption of best practices in implementing subscription-based access control. By following documented steps, you're more likely to adhere to security and implementation standards recommended by Stripe and web development guidelines.

Troubleshooting and Support: Well-documented processes help in troubleshooting issues that may arise during or after the implementation. When developers or support staff need to resolve problems, they can refer to the documentation to understand the setup and configuration, making it easier to diagnose and fix issues.

Scalability and Maintenance: Documentation makes it easier to scale and maintain the system. As your application grows or undergoes updates, having a documented setup helps in making informed changes that won't disrupt the existing subscription management.

Legal Compliance and Transparency: For services offering subscription-based access, it's important to maintain transparency about how user access is managed and protected. Documentation helps in ensuring compliance with legal requirements related to subscriptions and digital content access.

@KazeroG KazeroG changed the title Documentation on how to protect page with Stripe Subscription Add Documentation on : how to protect page with specific Stripe Subscription Feb 17, 2024
vishwamartur added a commit to vishwamartur/saas-starter-kit that referenced this issue Oct 30, 2024
…ption

Related to boxyhq#1041

Add documentation and code changes to protect a page with a specific Stripe Subscription.

* **README.md**:
  - Add a new section explaining how to protect a page with a specific Stripe Subscription.
  - Include code examples for checking active Stripe Subscription in `middleware.ts` and `AccessControl.tsx`.

* **components/shared/AccessControl.tsx**:
  - Import `useActiveSubscription` hook.
  - Add a check for active Stripe Subscription in the `useCanAccess` hook.
  - Update the `AccessControl` component to include the new check.

* **middleware.ts**:
  - Import `getByCustomerId` from `models/subscription`.
  - Add a check for active Stripe Subscription before allowing access to protected routes.
  - Update the `redirectUrl` logic to handle subscription-based access control.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant