Giter VIP home page Giter VIP logo

stripe-demo-connect-roastery-saas-platform's Introduction

Roastery demo SaaS platform using Stripe Connect

NOTE: this demo uses the OAuth method to connect Stripe accounts. For an example that uses the API method, see Connect Onboarding for Standard accounts.

This sample shows how to build a coffee roastery themed SaaS platform using Stripe Checkout and Stripe Connect, where coffee roasteries can signup to get their website and wholesale shop with just a few clicks. The Roastery platform takes an application fee for every transaction happening on the platform.

Platform owners re on-boarded using Stripe Connect Standard where they connect their existing Stripe account. When the marketplace accepts funds via card payments, the funds are routed to the seller's Stripe accounts as a part of each marketplace transaction.

See a hosted version of the https://roastery.stripe.dev

Preview of recipe

Features

  • Basic user authentication system.
  • Stripe onboarding using Stripe Connect Standard.
  • Payments via Stripe Checkout.
  • Basic platform website for each platform.
  • Custom platform dashboard.

Architecture

The marketplace is implemented as as full-stack application powered by Next.js and contains a React front-end, and a Node.js REST API.

The app renders its React components as both the server and client-side using isomorphic rendering.

Technical features

  • Authentication system using JWT tokens with login and signup pages.
  • Storage using LowDB to provide a basic local JSON database.
  • REST API scaffolding with authentication endpoints for resources like listings, login, payouts, profile, signup, transactions, and users.
  • Card payments are accepted via Stripe Checkout

Getting started

To run this sample locally all you need is checkout the repo and run the app.

You will need a Stripe account with its own set of API keys, and enable a few features for your Stripe Account.

Don't worry, just follow the steps in this guide.

1. Clone and configure the sample

git clone [email protected]:stripe/stripe-demo-connect-roastery-saas-platform.git

2. Configure Stripe

The first thing you need to do is to Create a Connect platform. You do that by going to https://dashboard.stripe.com/test/connect/overview.

Once you have registered your Connect platform, you can now generate a Connect User Id. You need this together with your Stripe API keys.

3. Enable OAuth for Standard

Go to the Connect settings and enable OAuth for Standard Accounts. In addition, configure the redirect URIs for your local instance. For example, if you are running this demo locally at http://localhost:3000, you will need to add the following to the Redirects section: http://localhost:3000/stripe/callback

4. Get Stripe API keys and configure environment variables

Go to the Stripe developer dashboard to find your API keys (developer settings), and your Connect User Id (Connect settings).

Copy the .env.example file into a file named .env in the folder of the server you want to use. For example:

cp .env.example .env

Now copy your Stripe API keys and Connect User id into your .env file:

STRIPE_PUBLIC_KEY=<replace-with-your-publishable-key>
STRIPE_SECRET_KEY=<replace-with-your-secret-key>
STRIPE_CLIENT_ID=<replace-with-your-connect-client-id>

Save the .env file and you should be good.

Set up Redirect URI

After the user completes the flow to connect their Stripe account, Stripe needs to redirect the user back to your application. You can do this with a redirect_uri parameter, but this project does not use that method. Instead, "If no redirect_uri is specified in the URL, then Stripe uses the first URI configured in your platform settings" (source). So go to your Connect settings, and under Integration > Redirects, click "Add URI", and enter http://localhost:3000/stripe/callback.

Using the sample app

  1. Run npm install
  2. Run npm run dev
  3. You are now ready to use the app running in http://localhost:3000.
  4. The marketplace should be available, and if you go to /login you should be able to login as both buyers and sellers using the demo buttons.
  5. ๐ŸŽ‰

FAQ

Q: Why did you pick these frameworks?

A: We chose the most minimal framework to convey the key Stripe calls and concepts you need to understand. These demos are meant as an educational tool that helps you roadmap how to integrate Stripe within your own system independent of the framework.

Q: Can you show me how to build X?

A: We are always looking for new recipe ideas, please email [email protected] with your suggestion!

Author(s)

@auchenberg-stripe

stripe-demo-connect-roastery-saas-platform's People

Contributors

auchenberg-stripe avatar cjavilla-stripe avatar dependabot[bot] avatar jameshfisher avatar mfix-stripe avatar paulasjes-stripe avatar streeter avatar streeter-stripe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

stripe-demo-connect-roastery-saas-platform's Issues

Business website "https://roastery.stripe.dev/" is "Not a valid URL"

The Stripe Connect flow asks for my business website. My business's website would be hosted on the Roastery platform, so I entered https://roastery.stripe.dev/. Surprisingly this gives the error "Not a valid URL".

It seems to ban any URL with a domain ending in stripe.dev or stripe.com.

Maybe good reasons for this, but if so, the demo should be on a clearly non-Stripe domain, e.g. roastery.stripedemos.dev.

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.