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

Remove checkoutSessionId from project #282

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions opensaas-sh/app_diff/schema.prisma.diff
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
- paymentProcessorUserId String? @unique
- lemonSqueezyCustomerPortalUrl String? // You can delete this if you're not using Lemon Squeezy as your payments processor.
+ stripeId String? @unique
checkoutSessionId String?
subscriptionStatus String? // 'active', 'canceled', 'past_due', 'deleted'
subscriptionStatus String? // 'active', 'cancel_at_period_end', 'past_due', 'deleted'
subscriptionPlan String? // 'hobby', 'pro'
sendNewsletter Boolean @default(false)
3 changes: 1 addition & 2 deletions opensaas-sh/app_diff/src/server/scripts/dbSeeds.ts.diff
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
--- template/app/src/server/scripts/dbSeeds.ts
+++ opensaas-sh/app/src/server/scripts/dbSeeds.ts
@@ -38,10 +38,12 @@
@@ -38,9 +38,11 @@
sendNewsletter: false,
credits,
subscriptionStatus,
- lemonSqueezyCustomerPortalUrl: null,
- paymentProcessorUserId: hasUserPaidOnStripe ? `cus_test_${faker.string.uuid()}` : null,
+ stripeId: hasUserPaidOnStripe ? `cus_test_${faker.string.uuid()}` : null,
datePaid: hasUserPaidOnStripe ? faker.date.between({ from: createdAt, to: lastActiveTimestamp }) : null,
checkoutSessionId: hasUserPaidOnStripe ? `cs_test_${faker.string.uuid()}` : null,
subscriptionPlan: subscriptionStatus ? faker.helpers.arrayElement(getSubscriptionPaymentPlanIds()) : null,
+ // For the demo app, we want to default isMockUser to true so that our admin dash only shows mock users
+ // and not real users signing up to test the app
Expand Down
3 changes: 0 additions & 3 deletions opensaas-sh/blog/src/content/docs/general/user-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ entity User {=psl
isAdmin Boolean @default(false)
paymentProcessorUserId String? @unique
lemonSqueezyCustomerPortalUrl String? // You can delete this if you're not using Lemon Squeezy as your payments processor.
checkoutSessionId String?
subscriptionPlan String?
subscriptionStatus String?
sendEmail Boolean @default(false)
Expand All @@ -46,7 +45,6 @@ entity User {=psl
id Int @id @default(autoincrement())
//...
paymentProcessorUserId String? @unique
checkoutSessionId String?
subscriptionPlan String?
subscriptionStatus String?
datePaid DateTime?
Expand All @@ -56,7 +54,6 @@ psl=}
```

- `paymentProcessorUserId`: The payment processor customer ID. This is created on checkout and used to identify the customer.
- `checkoutSessionId`: The payment processor checkout session ID. This is created by Stripe on checkout and used to identify the checkout session.
- `subscriptionPlan`: The subscription plan the user is on. This is set by the app and is used to determine what features the user has access to. By default, we have three plans: `hobby` and `pro` subscription plans, as well as a `credits10` one-time purchase plan.
- `subscriptionStatus`: The subscription status of the user. This is set by the payment processor and is used to determine whether the user has access to the app or not. By default, we have four statuses: `active`, `past_due`, `cancel_at_period_end`, and `deleted`.
- `credits` (optional): By default, a user is given 3 credits to trial your product before they have to pay. You can create a one-time purchase product in Stripe to allow users to purchase more credits if they run out, e.g. the `credits10` plan in the template.
Expand Down
1 change: 0 additions & 1 deletion template/app/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ model User {

paymentProcessorUserId String? @unique
lemonSqueezyCustomerPortalUrl String? // You can delete this if you're not using Lemon Squeezy as your payments processor.
checkoutSessionId String?
subscriptionStatus String? // 'active', 'cancel_at_period_end', 'past_due', 'deleted'
subscriptionPlan String? // 'hobby', 'pro'
sendNewsletter Boolean @default(false)
Expand Down
1 change: 0 additions & 1 deletion template/app/src/server/scripts/dbSeeds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ function generateMockUserData(): MockUserData {
lemonSqueezyCustomerPortalUrl: null,
paymentProcessorUserId: hasUserPaidOnStripe ? `cus_test_${faker.string.uuid()}` : null,
datePaid: hasUserPaidOnStripe ? faker.date.between({ from: createdAt, to: lastActiveTimestamp }) : null,
checkoutSessionId: hasUserPaidOnStripe ? `cs_test_${faker.string.uuid()}` : null,
subscriptionPlan: subscriptionStatus ? faker.helpers.arrayElement(getSubscriptionPaymentPlanIds()) : null,
};
}
Loading