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

stripe subscription E2E payment integration #33

Merged
merged 1 commit into from
Dec 23, 2024

Conversation

emmdim
Copy link
Member

@emmdim emmdim commented Dec 19, 2024

This commit represents a significant integration of Stripe's subscription payment system, allowing organizations to manage their subscriptions through Stripe's checkout process while maintaining synchronization with the application's database.

Key changes

API Routes & Handlers:

  • Added new endpoints for Stripe integration:
    • POST /subscriptions/checkout - Creates new subscription checkout sessions
    • GET /subscriptions/checkout/{sessionID} - Retrieves checkout session information
  • Enhanced webhook handling to process subscription events of
    POST /subscriptions/webhook
    • customer.subscription.created
    • customer.subscription.updated
    • customer.subscription.deleted

Database Schema Updates

  • Modified OrganizationSubscription structure:
    • Removed EndDate field
  • Updated Plan structure:
    * Added StripePriceID field

Error Handling:

  • Added new error definition: ErrStripeError

@emmdim emmdim requested a review from lucasmenendez December 19, 2024 22:18
@emmdim emmdim force-pushed the f/handle_stripe_subscription branch 4 times, most recently from 8a326f4 to c582970 Compare December 20, 2024 15:25
Copy link
Contributor

@lucasmenendez lucasmenendez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good and is well structured. One suggestion, to improve clarity would be to add some comments in the code, not just in the functions and structs declarations, but also around the more complex parts of the logic or third party code.

api/docs.md Outdated Show resolved Hide resolved
api/stripe.go Show resolved Hide resolved
api/types.go Show resolved Hide resolved
@emmdim emmdim force-pushed the f/handle_stripe_subscription branch from c582970 to 27a65e3 Compare December 23, 2024 15:57
@emmdim emmdim requested a review from lucasmenendez December 23, 2024 15:58
@emmdim emmdim force-pushed the f/handle_stripe_subscription branch from 27a65e3 to 5b412b7 Compare December 23, 2024 17:34
api/stripe.go Outdated Show resolved Hide resolved
api/stripe.go Outdated Show resolved Hide resolved
api/stripe.go Outdated Show resolved Hide resolved
@emmdim emmdim force-pushed the f/handle_stripe_subscription branch from 5b412b7 to 6b17e26 Compare December 23, 2024 18:04
@emmdim emmdim requested a review from lucasmenendez December 23, 2024 18:07
Copy link
Contributor

@lucasmenendez lucasmenendez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some nits

stripe/stripe.go Show resolved Hide resolved
api/stripe.go Outdated Show resolved Hide resolved
    - Add subscription checkout endpoints (/checkout, /checkout/{sessionID})
    - Handle subscription lifecycle webhooks (created, updated, deleted)
    - Update database schema for subscription and plan models
    - Add Stripe client methods for checkout session management
    - Document new subscription API endpoints and error handling
@emmdim emmdim force-pushed the f/handle_stripe_subscription branch from 6b17e26 to 346f7a5 Compare December 23, 2024 18:11
@emmdim emmdim merged commit d30b5a5 into main Dec 23, 2024
6 checks passed
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.

2 participants