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

Refactor: Stripe Handling New ULTRA Plan #300

Open
wants to merge 141 commits into
base: chat-everywhere
Choose a base branch
from

Conversation

1orZero
Copy link
Collaborator

@1orZero 1orZero commented May 31, 2024

  • removed the meta data support in Stripe (plan_code / planGivenWeeks)
  • Re-factor the Stripe webhook implementation
  • Allow user to Upgrade or Downgrade plan (Show modal popup and operate manually by us)
  • All production/staging stripe payment links has been created
  • We now have a central configuration file to manage all Stripe products stripe_config.ts

1orZero added 30 commits May 27, 2024 14:47
… handleCustomerSubscriptionDeleted and handleCustomerSubscriptionUpdated
… handleCustomerSubscriptionDeleted and handleCustomerSubscriptionUpdated
Update the payment links for the Pro and Ultra plans in the stripe_config.ts file. Add separate links for the monthly plans in USD and TWD currencies. Also, add links for the yearly Ultra plan in USD and TWD currencies. Remove the unused constant in the file.
@1orZero
Copy link
Collaborator Author

1orZero commented Jul 12, 2024

Test Payment Flow for Cypress

Steps

  1. Make sure the user is on Free plan.
  2. Cypress calls the /api/cypress/test-payment-event endpoint to start the test.
    • The endpoint will send a stripe webhook to the /api/webhooks/stripe endpoint.
  3. The webhook will update the user's subscription plan to pro-monthly.
  4. Cypress refreshes the page and checks if the user is on Pro plan.
  5. After each test, Cypress call a /api/cypress/reset-test-payment-user-subscription endpoint to reset the user's subscription plan to free.

TODOs

  • Pass the current vercel url to the cypress test
  • create api endpoint to trigger stripe webhook api/cypress/test-payment-event
  • create api endpoint to reset user's subscription plan
  • create the test

Changes

  • Add new API route api/cypress/test-payment-event to trigger stripe webhook
  • Add new API route api/cypress/reset-test-payment-user-subscription to reset user's subscription plan
  • Add new test cypress/e2e/payment.cy.ts to test the payment flow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants