Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Accepting a payment

An Express server implementation

You can 🎥 watch a video to see how this server was implemented and read the transcripts.

Requirements

How to run

  1. Confirm .env configuration

Ensure the API keys are configured in .env in this directory. It should include the following keys:

# Stripe API keys - see https://stripe.com/docs/development/quickstart#api-keys
STRIPE_PUBLISHABLE_KEY=pk_test...
STRIPE_SECRET_KEY=sk_test...

# Required to verify signatures in the webhook handler.
# See README on how to use the Stripe CLI to test webhooks
STRIPE_WEBHOOK_SECRET=whsec_...

# Path to front-end implementation. Note: PHP has it's own front end implementation.
STATIC_DIR=../../client/html
DOMAIN=http://localhost:4242
Optionally - Add Stripe Tax Stripe Tax lets you calculate and collect sales tax, VAT and GST with one line of code. To enable Stripe Tax set up in the dashboard: [Docs - Set up Stripe Tax](https://stripe.com/docs/tax/set-up).

In "server.js", set calcuateTax to true if you want Stripe to calculate tax for the transactions in this application.

const calculateTax = true;
  1. Install dependencies and start the server
npm install
npm start
  1. If you're using the html client, go to localhost:4242 to see the demo. For react, visit localhost:3000.