Skip to content

Feature: Implement Subscription-Based Paid Routes#7

Open
aserven wants to merge 2 commits intomainfrom
add-subscription
Open

Feature: Implement Subscription-Based Paid Routes#7
aserven wants to merge 2 commits intomainfrom
add-subscription

Conversation

@aserven
Copy link
Contributor

@aserven aserven commented May 9, 2025

This pull request introduces a new "subscription" type for paid routes, allowing users to create routes that grant access based on a recurring monthly payment.

Key Changes:

  • Dashboard UI (cmd/server/templates/dashboard.html):
    • Added "Subscription" as an option in the "Type" dropdown when creating a new paid route.
    • Updated the tooltip for route types to include an explanation for subscriptions.
    • Added "Subscription" to the type filter in the "My Paid Routes" list.
    • Ensured "Subscription" type is correctly displayed in the list of routes.
    • Modified client-side JavaScript to hide the "Credits" input field when "Subscription" type is selected, defaulting credits to 1 (as subscriptions are time-based, not credit-based for access).
  • Route Handling (routes/handler.go):
    • Enhanced the tryExistingPayment logic to support subscriptions:
      • For purchases with type "subscription", it now checks if the subscription is active (i.e., within one month of its creation date).
      • If the subscription is active, access is granted without decrementing credits.
      • If expired, the flow proceeds to a new payment.
  • Route Service (routes/service.go):
    • Updated the CreatePaidRoute service method to validate the routeType, ensuring it's one of the allowed types ("credit" or "subscription").

This feature expands the monetization options for users by enabling time-based access to their paid routes alongside the existing credit-based and one-time payment models.

@aserven aserven changed the base branch from main to add-credits May 9, 2025 10:03
@aserven aserven changed the base branch from add-credits to main May 12, 2025 16:07
@kafkasl kafkasl force-pushed the main branch 3 times, most recently from ed1fa85 to d523268 Compare May 16, 2025 13:11
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

Successfully merging this pull request may close these issues.

1 participant