Giter Club home page Giter Club logo

sveltekit-stripe's Introduction

SvelteKit Stripe Integration

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.

Check it out at https://sveltekit-stripe.netlify.app/.

This demo application implements subscriptions using SvelteKit and Stripe Checkout. It is based on this guide.

How to use.

First you need to have an account on Stripe.

  • Clone or fork the project git clone https://github.com/srmullen/sveltekit-stripe.git

  • Install the dependencies cd sveltekit-stripe && npm install

  • Rename .env.example to .env and update with your Stripe public and private api keys. You can get them from the Stripe dashboard.

  • Create products and prices on Stripe, using the script provided by this repo. npm run stripe:init This script creates the Stripe entities needed for a subscription billing model and writes them to a json file that will be loaded by a SvelteKit endpoint. You can also create the entites needed by using the Stripe dashboard, following this section of the guide.

  • Start up the development server npm run dev

Stripe Webhooks

This repo contains a SvelteKit endpoint for Stripe Webhook events.

To test the hook locally see this guide 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.

See the demo

https://sveltekit-stripe.netlify.app

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

sveltekit-stripe's People

Contributors

srmullen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.