Giter Site home page Giter Site logo

maggielerman / checkout-netlify-serverless Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stripe-samples/checkout-netlify-serverless

0.0 1.0 0.0 1.74 MB

Sell products on the Jamstack with Netlify Functions and Stripe Checkout!

Home Page: https://checkout-netlify-serverless.netlify.com/

License: MIT License

JavaScript 41.71% CSS 10.83% HTML 47.46%

checkout-netlify-serverless's Introduction

Serverless Stripe Checkout with Netlify Functions

Use Stripe Checkout with Netlify Functions to sell your products online.

Demo

Stripe Checkout with Netlify functions demo gif

Features:

  • Load products from a JSON product catalogue
  • Create Checkout Sessions with Netlify Functions
  • Process Stripe webhook events with Netlify Functions to handle fulfillment

How to run locally

Prerequisites

Follow the steps below to run locally.

1. Clone and configure the sample

git clone https://github.com/stripe-samples/checkout-netlify-serverless

Copy the .env.example file into a file named .env in the functions folder. For example:

cp .env.example .env

You will need a Stripe account in order to run the demo. Once you set up your account, go to the Stripe developer dashboard to find your API keys.

STRIPE_PUBLISHABLE_KEY=<replace-with-your-publishable-key>
STRIPE_SECRET_KEY=<replace-with-your-secret-key>

2. Run Netlify Functions locally:

You can run the Netlify Functions locally with Netlify Dev:

npm run functions
netlify dev

3. [Optional] Run a webhook locally:

If you want to test the using-webhooks integration with a local webhook on your machine, you can use the Stripe CLI to easily spin one up.

Make sure to install the CLI and link your Stripe account.

In a separate tab run

stripe listen --forward-to localhost:8888/.netlify/functions/handle-purchase

Or use the shorthand npm run webhook

The CLI will print a webhook secret key to the console. Set STRIPE_WEBHOOK_SECRET to this value in your .env file.

You should see events logged in the console where the CLI is running.

When you are ready to create a live webhook endpoint, follow our guide in the docs on configuring a webhook endpoint in the dashboard.

๐Ÿ’ซ Deploy with Netlify

Deploy to Netlify

Get support

If you found a bug or want to suggest a new [feature/use case/sample], please file an issue.

If you have questions, comments, or need help with code, we're here to help:

Sign up to stay updated with developer news.

Authors

checkout-netlify-serverless's People

Contributors

thorsten-stripe avatar maggielerman avatar ch-stripe avatar trag-stripe avatar dawn-stripe avatar jlengstorf avatar

Watchers

James Cloos 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.