Back to templates

Template details

Gatsby Stripe Element

Gatsby starter demonstrating Stripe Element payments with Netlify Functions.

About this template

Gatsby Stripe Element is a Gatsby starter that demonstrates how to integrate a Stripe Element payment form into a Gatsby site, using Netlify Functions as the serverless backend for payment processing. Built by alexislepresle and published as a public GitHub repository, the starter pairs Gatsby's React-based static site generation with Bulma for styling and Stripe's pre-built card UI.

What is Gatsby Stripe Element?

Gatsby Stripe Element is a starter template that wires a Stripe Elements payment form to Netlify Functions. It takes a simple Gatsby project skeleton as its starting point and adds the client-side card form plus a serverless function that can call Stripe's API without exposing secret keys in the browser. The project outputs a static Gatsby site that can be deployed to Netlify, and it includes a live demo hosted at stripe-element.netlify.com.

Key Features

  • Gatsby framework — built on Gatsby, a React-based static site generator; the quick start uses gatsby new to scaffold a new project from the repository.
  • Bulma styling — the demo's layout and components are styled with Bulma, a modern CSS framework with ready-to-use flexbox grid and form classes.
  • Stripe Elements — the payment form uses Stripe's embedded card element for collecting card details, with the integration shown in the project source.
  • Netlify Functions — serverless functions provide the backend; the quick start runs netlify-lambda serve to run functions locally during development.
  • One-click Deploy to Netlify — a Deploy to Netlify button in the README creates a new site from the repository directly on Netlify, including the serverless functions.
  • Local development workflow — development requires gatsby develop for the frontend and netlify-lambda serve for the functions, both documented in the quick start.

Who is it for?

  • Gatsby developers who want a concise, runnable example of Stripe Element integration without building the payment flow from scratch.
  • JAMstack developers who need to understand how Netlify Functions can keep Stripe secret keys server-side while the frontend stays static.
  • Learners exploring payment flows who want a minimal codebase that demonstrates the interaction between a client-side card form and a serverless payment endpoint.

What can you do with Gatsby Stripe Element?

  • Build a reference checkout: use the starter as a working example to model your own Stripe checkout, swapping the demo styling and fields for your own.
  • Learn the Stripe + Netlify Functions pattern: run the project locally with the quick start commands and inspect how the Stripe Element and the function communicate.
  • Deploy a payment-enabled demo: use the Deploy to Netlify button to publish a live version of the payment page with functions configured automatically.

How does the template work?

After scaffolding with gatsby new, the frontend runs on localhost:8000 through gatsby develop. Serverless functions are handled separately with netlify-lambda serve, and when deployed to Netlify the functions run in the Netlify environment. The Stripe Element sends payment data to the function, which then uses Stripe's API to create a payment.

FAQ

Is Gatsby Stripe Element free?

Yes, the starter is open source and available on GitHub. You can use the Gatsby CLI to create a new site from it and deploy the repository to Netlify at no cost for the template itself.

What prerequisites do I need to run it locally?

You need the Gatsby CLI, Node.js, and a package manager. The quick start lists three commands: gatsby new, gatsby develop, and netlify-lambda serve. To process live payments you will also need Stripe API keys, but the demo can be viewed without them.

Where is the live demo?

The README links to a demo at stripe-element.netlify.com, deployed by the author alexislepresle from this starter.

screenshot of Gatsby Stripe Element on template0.com