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

feat: deno task init:stripe and further documentation improvements #93

Merged
merged 9 commits into from
Apr 17, 2023

Conversation

iuioiua
Copy link
Contributor

@iuioiua iuioiua commented Apr 16, 2023

Previously, a bit of manual work was required to set up Stripe. This change adds the init:stripe task, which:

  1. Automatically creates the "Premium tier" product.
  2. Automatically creates the default billing portal configuration used in the /dashboard/manage-subscription route.
  3. Prints the "Premium tier" product price ID to be copied into constants.ts.

This dramatically reduces the time and steps needed and the chance of errors in setting up Stripe.

Contributors, please feel free to test and provide feedback.

@iuioiua iuioiua requested a review from lambtron April 16, 2023 23:52
Copy link
Contributor

@lino-levan lino-levan left a comment

Choose a reason for hiding this comment

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

This looks fine as a v1, but I'm wondering if providing some flags would make sense? Not sure if it is in scope for this "getting started" script.

@iuioiua
Copy link
Contributor Author

iuioiua commented Apr 17, 2023

This looks fine as a v1, but I'm wondering if providing some flags would make sense?

What do you suggest?

Not sure if it is in scope for this "getting started" script.

It was deliberately written to replace instructions with automatic setup. Why would that be?


async function createPremiumTierProduct(stripe: Stripe) {
return await stripe.products.create({
name: "Premium tier",
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if the stuff in this object should be configurable? Does that make any sense?

Copy link
Contributor Author

@iuioiua iuioiua Apr 17, 2023

Choose a reason for hiding this comment

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

Good suggestion. Though, we'll leave this as-is for now in the spirit of prioritising ease of setup over customizability. Either way, I've improved the comment.

@lino-levan
Copy link
Contributor

That seems good enough for now. LGTM

Copy link
Contributor

@niklasmtj niklasmtj left a comment

Choose a reason for hiding this comment

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

Looks good! I think this will prevent a lot of headache for people starting out with Stripe

This comment was marked as resolved.

README.md Outdated
[your Stripe dashboard settings](https://dashboard.stripe.com/test/apikeys)
to copy the `STRIPE_SECRET_KEY` into your `.env` file. We recommend using the
test key for your development environment.
> Note: go to [init/stripe.ts] if you'd like to learn more about how the
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@niklasmtj, regarding #93 (comment), I'd rather have one or the other. I've added this comment to point people in the right direction if they want to learn more. At some point, I'll include technical details as JSDoc comments in the implementation to give an even more precise idea of what's happening. Do you think this addresses your concern?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good to me 👍🏼

@iuioiua iuioiua changed the title feat: deno task init:stripe feat: deno task init:stripe and further documentation improvements Apr 17, 2023
@iuioiua
Copy link
Contributor Author

iuioiua commented Apr 17, 2023

I just tested this locally, and it works! 🥳

@iuioiua iuioiua marked this pull request as ready for review April 17, 2023 07:39
@iuioiua iuioiua merged commit 06ba713 into main Apr 17, 2023
@iuioiua iuioiua deleted the deno-task-init-stripe branch April 17, 2023 07:42
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.

3 participants