Code Monkey home page Code Monkey logo

example-store-stripe's Introduction

Stripe Example Store

Welcome to the Stripe Example Store! This repo is an example of a RedwoodJS-Stripe integration. Most startups need a way to process payments. We designed this repo to demonstrate how you could go about integrating Stripe into your RedwoodJS project. In this repo, you'll see how to:

Keep reading to get started or check out the Roadmap to see the features we've got planned.

Getting Started

  1. Clone this repo, cd into it, and yarn install
git clone [email protected]:redwoodjs/example-store-stripe.git
cd example-store
yarn install
  1. Get your Stripe test keys

To develop on this repo locally, you'll need to populate your .env file with a few env vars. The first of those is your Stripe test keys.

You'll need a Stripe account to get your test keys. If you don't already have one, you can make one here: https://dashboard.stripe.com/login?redirect=%2Ftest%2Fdashboard.

Once you've made your account, if you weren't automatically redirected, navigate to your test dashboard. You'll find your test keys over on the right:

image

Make sure "Test mode" is on

You can toggle "Test mode" on and off with the toggle in the upper right. Make sure it's always on. You should always see the orange "Test Data" banner.

Now that you've got your test keys, your .env should look like:

STRIPE_PK=pk_test_...
STRIPE_SK=sk_test_...

You'll need one more Stripe env var: the Stripe webhook secret (STRIPE_WEBHOOK_SK). You can get it from the Stripe CLI:

stripe listen --api-key=sk_test_... --print-secret

Note that the value of the --api-key flag should be the same as STRIPE_SK.

Now your .env file should look like this:

STRIPE_PK=pk_test_...
STRIPE_SK=sk_test_...
STRIPE_WEBHOOK_SK=whsec_...
  1. Setting up your database

To tie things up, you'll need one more env var. The Stripe Example Store uses Postgres, so before you can migrate your database, you'll need to set your DATABASE_URL env var.

If you don't already Postgres setup locally, it can be a little tricky to do so. If you're on a Mac, Postgres.app is a tried-and-true solution. We don't have recommendations for other platforms, but one thing we do recommend is using railway.app—even for local development—since it trivializes this whole process.

Once you've added your DATABASE_URL to your .env file, you're ready to migrate your database:

yarn rw prisma migrate dev

Now you should be able to start the dev server!

yarn rw dev
  1. Listening for webhooks

In tandem with the dev server, you'll want to use the stripe CLI to start a process that listens for webhooks:

stripe listen --forward-to 'localhost:8911/stripeWebhooks'

Make sure to pass the serverless function that's going to receive webhooks to the --forward-to flag.

Roadmap

There's a lot more ways we plan to integrate RedwoodJS with Stripe. Open an issue or a PR to let us know what features you'd like to see!

Leadership

Chris is the project lead and Dom is point from the RedwoodJS Core Team.

History

This repo is the second iteration of the RedwoodJS-Stripe project. The first can be found in the redwoodjs-stripe repo.

The first was focused on integrating Stripe with RedwoodJS from the ground up. This presented many technical challenges, namely, how can we make RedwoodJS a more-pluggable Framework.

This project takes the opposite approach by focusing on what a Stripe integration in a RedwoodJS Project would look like.

example-store-stripe's People

Contributors

renovate[bot] avatar chrisvdm avatar jtoar avatar redwoodjsbot avatar thedavidprice avatar izhar360 avatar

Watchers

Sammy filly  avatar

example-store-stripe's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • Update dependency open-props to v1.7.4
  • Update Node.js to v20
  • Update Yarn to v4
  • Update dependency @stripe/stripe-js to v3
  • Update dependency stripe to v15
  • 🔐 Create all rate-limited PRs at once 🔐

Errored

These updates encountered an error and will be retried. Click on a checkbox below to force a retry now.

  • Update xstate monorepo (@xstate/immer, xstate)

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • redwoodjs/project-ci-action v0.1.1
npm
api/package.json
  • @redwoodjs/api 1.0.0
  • @redwoodjs/graphql-server 1.5.2
  • graphql-scalars 1.22.2
  • stripe 8.222.0
package.json
  • styled-system 5.1.5
  • @playwright/test 1.38.1
  • @redwoodjs/core 1.5.2
  • node >=14.17 <=16.x
  • yarn 3.6.3
web/package.json
  • @redwoodjs/auth 1.5.2
  • @redwoodjs/forms 1.5.2
  • @redwoodjs/router 1.5.2
  • @redwoodjs/web 1.5.2
  • @stripe/stripe-js 1.54.2
  • @xstate/immer 0.3.1
  • @xstate/react 2.0.1
  • immer 9.0.21
  • open-props 1.5.16
  • prop-types 15.8.1
  • react 17.0.2
  • react-dom 17.0.2
  • react-feather 2.0.10
  • styled-components 5.3.11
  • xstate 4.30.6
nvm
.nvmrc

  • Check this box to trigger a request for Renovate to run again on this repository

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.