GitXplorerGitXplorer
s

checkout-netlify-serverless

public
96 stars
23 forks
2 issues

Commits

List of commits on branch main.
Verified
4dc8f2b770e05245542e81409352a67858e13fe8

Track SKU details in Metadata (#2)

tthorsten-stripe committed 5 years ago
Unverified
ca66a9d979579e5c234963916eb69d4be868f70b

Fixes for Netlify CLI

tthorsten-stripe committed 5 years ago
Verified
e83918ed9adebd5d654f6a9710cffce3bf3164f6

[Webhook] Send email to fulfillment provider via Sendgrid (#1)

tthorsten-stripe committed 5 years ago
Unverified
87accfed559f4cefc13409c98b0c5d03674bbef6

Update README

tthorsten-stripe committed 5 years ago
Unverified
e49629c682de771d68f30995bd3a5484075b8d4f

Add cli.json file

tthorsten-stripe committed 5 years ago
Verified
d7206dc1aab50b3ad4ab27ccf4d519ce47d41854

Label webhook secret as optional.

tthorsten-stripe committed 5 years ago

README

The README file for this repository.

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