Skip to content

rogersnick/pay-what-you-can-stripe-checkout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Custom Stripe Checkout Example

This code implements a simple Stripe checkout sales page.

Running the sample

  1. Install dependencies
npm install
  1. Set environment variables. Create a local file called .env that contains the following:
STRIPE_API_KEY=sk_test_...
YOUR_DOMAIN=http://localhost:4242
  1. Run the server
npm start
  1. Open up http://localhost:4242/

Details and Customization

Stripe Checkout is the fastest way to get started with payments. This template contains three important files:

/public - these files are served directly as is and contain no secret information

  • index.html: The actual form that users will see which initiates a post to the backend. Change this to alter how you sales page appears
  • success.html: Displayed to users upon a successful purchase
  • winback.html - Displayed to users if they return from the purchase screen without completing a purchase

/ - root files that run "on the server" and contain private information like API keys (these are stored in environment settings)

  • server.js: exposes one endpoint called /create-checkout-session that answers the post request from the client facing form and forwards the user to a payment page

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published