Giter Club home page Giter Club logo

vuejs-nation's Introduction

Accept payments using Vue 3, Express.js and Stripe Checkout

This demo shows you how to integrate with Stripe Checkout using Vue 3 and Express.js. It was presented as part of a talk at Vue.js Nation 2022. You can find the slides here.

Building a payment form UI from scratch is difficult -- input field validation, error message handing, and localization are just a few things to think about when designing a simple checkout flow.

Checkout is a Stripe-hsosted payment form that does the hard work for you so that you can focus on building the best storefront experience for your customers.

Once your customer is ready to pay, use the Stripe Checkout API to redirect them to the URL of your Stripe hosted payment page.

Demo

The demo is running in test mode -- use 4242424242424242 as a test card number with any CVC + future expiration date.

Use the 4000002500003155 test card number to trigger a 3D Secure challenge flow.

How to use this demo

Setup steps in server/

  1. Register for a free Stripe account if you don't have one.
  2. Create a .env file using the .env.example template
  3. Add your Stripe secret key, which you can get from the Stripe dashboard
  4. Create products using the product information in USER_SHOPPING_CART using the Stripe dashboard or Products and Prices API
  5. Replace the {{PRODUCT_ID}} with test Stripe Price IDs in server.js
  6. Optional: Update the URL for the success_url and cancel_url parameters in server.js, if you've changed the default port for Vite (3000)

Setup steps in client/

  1. Optional: Update vite.config.js to another use a different address/port if you're using a backend server other than express or have changed the port.

vuejs-nation's People

Contributors

charlesw-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

Watchers

 avatar

vuejs-nation's Issues

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.