Skip to content

Stripe Subscriptions Plugin#62

Merged
Brayden merged 3 commits intomainfrom
bwilmoth/stripe-plugin
Jan 15, 2025
Merged

Stripe Subscriptions Plugin#62
Brayden merged 3 commits intomainfrom
bwilmoth/stripe-plugin

Conversation

@Brayden
Copy link
Member

@Brayden Brayden commented Jan 13, 2025

Purpose

Easily supporting Stripe Subscriptions in your user facing applications shouldn't feel like a headache waiting to happen or a nightmare you're putting off. As part of the Starbase plugin ecosystem we want to tackle some of the hardest developer challenges with simple lines of required code so developers can focus on what makes their applications... theirs.

This pull request introduces the ability to provide two values from Stripe for your database to start tracking subscriptions. When the plugin is registered it will automatically create a SQL table on your behalf with the correct schema. When a user checks out a product via a Stripe Product Link the entries will be stored in your database automatically. And when a product/subscription is cancelled a webhook will be triggered that marks it with a soft delete by populating the deleted_at column in the database table.

Tasks

  • Automatically create a database table to handle subscription logic
  • Allow users to add a Stripe plugin to subscribe and unsubscribe
  • Have a webhook endpoint Stripe can trigger on server event changes

Verify

Include the plugin in ./src/index.ts

import { StripeSubscriptionPlugin } from './plugins/stripe'
const plugins = [
    // ... other plugins
    new StripeSubscriptionPlugin({
        stripeSecretKey: 'sk_test_**********',
        stripeWebhookSecret: 'whsec_**********',
    }),
] satisfies StarbasePlugin[]

Before

After

StripeDemo.mov

@Brayden Brayden self-assigned this Jan 13, 2025
@Brayden Brayden added the enhancement New feature or request label Jan 13, 2025
@Sh4yy
Copy link

Sh4yy commented Jan 13, 2025

LGTM. Ship it.

@Brayden Brayden merged commit 8e36487 into main Jan 15, 2025
@Brayden Brayden deleted the bwilmoth/stripe-plugin branch January 15, 2025 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants