flowcore-io / luttaka-open

The open source event experience app powered by the Flowcore Data Management Platform
https://luttaka.com
MIT License
11 stars 11 forks source link

Missing Stripe documentation #81

Closed suuunly closed 3 months ago

suuunly commented 3 months ago

Is your improvement request related to a specific problem in the code or project structure? Please describe. šŸ‘Øā€šŸ’» Currently, it may be hard to run the application locally, as the application requires you to run a test stripe environment, with the added tunnel from your local machine to the stripe servers.

Additionally, there are 3 .env variables that are not well documented, and might be difficult to understand at first glance.

Describe the improvement or refactor you would like šŸŽÆ This should be in the README file. Containing the following:

  1. How to setup a Test Stripe account (without having to provide banking information)
  2. How to populate the .env variables (all of which are done from your stripe account):
    1. NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
    2. STRIPE_SECRET_KEY
    3. WEBHOOK_SECRET
  3. The prerequisites required to run the command stripe:listen command in the package.json a. By that I mean, installing the stripe cli for example
  4. Finally, update the run locally section to include the stripe:listen command

Additional context or comments Most of this can most likely be done by referencing Stripe's own documentation šŸ¤”

themujahidkhan commented 3 months ago

Hi @suuunly!

I would like to work on this issue,

  1. For setting up a Test Stripe account, would you want me to add a step-by-step guide or an article link that demonstrates how to set up Test Stripe account

  2. If we include the article link, populating the .env file will be easy. Otherwise, we need to explain it in a readme file, But I think the readme file will be lengthy.

  3. There is an extension available in the VS Code marketplace for Stripe CLI, which makes it easier for anyone to setup Stripe commands

Let me know what do you think?

suuunly commented 3 months ago

@themujahidkhan by all means! ā¤ļø

  1. Yes, I agree, that it would be better to link to their documentation about Setting up a Test Stripe Account;

  2. Again, I agree, that linking to their documentation on populating the two .env variables (public key and secret) is a good idea; perhaps we can link to a related section within a guide relating "Connecting Stripe to NextJS" to simplify the process?

  3. Currently there is a script in the package.json, called stripe:listen, which will automatically start listening for callbacks from Stripe. When you run the command, it also automatically displays the final .env key (the webhook related one) - that the user can plop right in to the .env file. However, it does require the user to have the stripe cli installed. One danger about relying on vs code extensions, is that not everyone uses vs code, given the rise of new IDEs šŸ˜³

    • One note on why the stripe:listen command is favoured, is because it also auto routes the callback to an endpoint within the app šŸ˜„
    • Granted, this also means we need to specify that the stripe:listen command as the 8th step in the run locally numeric guide:
image
themujahidkhan commented 3 months ago

Hey @suuunly

Screenshot for the Setting up Stripe account

image

Screenshot for Running locally section

image

suuunly commented 3 months ago

Looks good šŸ˜„ The only changes I would suggest, are:

  1. Instead of going through the lengthy process of explaining how to get the webhook secret, you can say "run the yarn stripe:listen command in the project - this will reveal the webhook secret"
  2. The final step in the Run locally section, should use yarn instead of npm run, and could be shortened to: "Run yarn stripe:listen in a separate terminal to listen for stripe changes"
themujahidkhan commented 3 months ago

Looks good šŸ˜„ The only changes I would suggest, are:

  1. Instead of going through the lengthy process of explaining how to get the webhook secret, you can say "run the yarn stripe:listen command in the project - this will reveal the webhook secret"
  2. The final step in the Run locally section, should use yarn instead of npm run, and could be shortened to: "Run yarn stripe:listen in a separate terminal to listen for stripe changes"

Done the changes,

Screenshot for Stripe

image

Screenshot for Run locally

image

suuunly commented 3 months ago

Oh, sorry for the confusion. I meant that when you run the yarn stripe:listen command, it shows you your webhook key. Like so:

image

So in step 8 of your first screenshot, you can flip the two tasks. šŸ˜› Run the command, and theeen then fill out the WEBHOOK_SECRET šŸ‘

Also, just a minor thing, regarding your second screenshot, could you simplify the final line to just say yarn stripe:listen, and maybe make it inline. It is mostly just to keep the format across the 8 steps consistent šŸ˜

But other than that, it looks good šŸ„³

suuunly commented 3 months ago

oh one detail that is missing, is the prerequisite that you need to have the CLI installed on your machine šŸ¤” You can make it a quick one liner saying install the Stripe CLI on your machine, and refer to this link: https://docs.stripe.com/stripe-cli

themujahidkhan commented 3 months ago

I've made changes as suggested,

Prerequisite

image

Setting up stripe account

image

Run Locally

image

suuunly commented 3 months ago

That looks great. The absolute fiiiinal note would be to mention the WEBHOOK_SECRET in the step 8, in the stripe account screenshot šŸ˜ If that is done, then I'd say it is done šŸ„³

themujahidkhan commented 3 months ago
  1. Run yarn stripe:listen in your terminal to retrieve the WEBHOOK_SECRET value directly in the terminal.

Would that work for you? Or need changes?

suuunly commented 3 months ago

That is perfect! šŸ‘šŸŽ‰

themujahidkhan commented 3 months ago

Done, I've opened a PR

suuunly commented 3 months ago

It has been approved and merged in šŸ˜„