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

Upgrade to Svelte 4.2.11 and Stripe 14.16.0. #10

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 2 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
VITE_STRIPE_PUBLIC_KEY={Your Stripe public key}
STRIPE_SECRET_KEY={Your Stripe private key}
# STRIPE_WEBHOOK_SECRET={Your stripe webhook secret}
STRIPE_SECRET_KEY_TEST={Your Stripe private key}
STRIPE_WEBHOOK_SECRET_TEST={Your stripe webhook secret}
30 changes: 30 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module.exports = {
root: true,
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:svelte/recommended',
'prettier'
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
extraFileExtensions: ['.svelte']
},
env: {
browser: true,
es2017: true,
node: true
},
overrides: [
{
files: ['*.svelte'],
parser: 'svelte-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser'
}
}
]
};
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ node_modules
/functions
/src/routes/plansData.json
.netlify
/.svelte-kit
/.svelte-kit
.vscode
6 changes: 5 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"pluginSearchDirs": ["."],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}

19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

**Update in this branch:**

* code is up to date with the latest versions of sveltekit & stripe apis
* enjoy ;-)


- Upgraded from Svelte 3.48.0 to 4.2.11
- Upgraded Stripe from 9.11.0 to 14.16.0
- enjoy ;-)

The SvelteKit demo template comes with an awesome counter application built in. It would be better though if it was a subscription SAAS counter. That's what this repo does.

Expand Down Expand Up @@ -35,16 +34,16 @@ First you need to have an account on [Stripe](https://stripe.com/).

### Stripe Webhooks

This repo contains a SvelteKit endpoint for Stripe Webhook events.
This repo contains a SvelteKit endpoint for Stripe Webhook events (/api/stripe/webhook).

To test the hook locally see this guide https://stripe.com/docs/webhooks/test
To test the hook locally, run `stripe listen --forward-to localhost:5173/api/stripe/webhook` and Stripe will forward webhook events to your local endpoint. See this guide for more on testing webhooks: https://stripe.com/docs/webhooks/test

The stripe webhook endpoint is https://localhost:3000/stripe/webhook. That is where you'll want to forward stripe events.

Verify webhook signatures by adding STRIPE_WEBHOOK_SECRET to your .env file.
When you run the Stripe listening server, a STRIPE_WEBHOOK_SECRET will print to your terminal. Add this to your `.env` file.

## See the demo

https://sveltekit-stripe.netlify.app

(Read more about the implementation here.)[https://www.srmullen.com/articles/sveltekit-stripe-integration]
[Read more about the implementation here](https://www.srmullen.com/articles/sveltekit-stripe-integration).

Upgrade by [sirbots](https://github.com/sirbots) in February 2024.
Loading