Giter VIP home page Giter VIP logo

stripe-checkout-lambda-serverless's Introduction

Serverless Stripe Checkout with AWS Lambda Functions

Use Stripe Checkout with AWS Lambda Functions to sell your products online. This is based on a similar demo for netlify.

Demo

Stripe Checkout with Netlify functions demo gif

From the original netlify demo:

Features:

  • Load products from a JSON product catalogue
  • Create Checkout Sessions with AWS Lambda Functions
  • Process Stripe webhook events with AWS Lambda 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/zoellner/stripe-checkout-lambda-serverless

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

cp .env.json.example .env.json

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 AWS Lambda Functions locally:

You can run the AWS Lambda Functions locally with SAM:

npm start

Then open http://localhost:3000/index.html in your browser

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:3000/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 AWS SAM

coming soon

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 that is related to Stripe, reach out to them:

Authors

In addition jlengstorf for the original netlify demo and thorsten-stripe from Stripe.

stripe-checkout-lambda-serverless's People

Contributors

thorsten-stripe avatar zoellner avatar cjavilla-stripe avatar ch-stripe avatar trag-stripe avatar dawn-stripe avatar jlengstorf avatar

Stargazers

Angel Baez 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.