GitXplorerGitXplorer
t

react-elements-netlify-serverless

public
2 stars
1 forks
0 issues

Commits

List of commits on branch master.
Unverified
05cb72b46f092b5d88572b2118369deace4b887d

Polish

tthorsten-stripe committed 4 years ago
Unverified
c8d063f590e3cef4bc480614dd40888e541f8192

Update to use-shopping-cart 2.0.0

tthorsten-stripe committed 4 years ago
Unverified
67afef80d87038a0bb53a6d4c68133f94fa7c456

Refactor PRAPI handling.

tthorsten-stripe committed 4 years ago
Unverified
ab3389b564200e5727459d7468b2c722bc682683

Update use-shopping-cart

tthorsten-stripe committed 4 years ago
Unverified
664446c9c16e1d5b4c816cfe0a6cdc667f4d5814

Initial commit

tthorsten-stripe committed 4 years ago
Unverified
2e084cbc28e0089f5defeb3e64864219c34c5b2a

Initialize project using Create React App

tthorsten-stripe committed 4 years ago

README

The README file for this repository.

Digital Wallet payments with React Stripe Elements and Netlify Functions

Modern browser APIs, like the Payment Request API, allow you to access payment credentials stored in your customer's digital wallets like Apple Pay, Google Pay, or even Chrome.

Stripe provides a Payment Request Button Element that securely tokenizes these stored credentials for a convenient checkout experience on mobile devices.

Demo

Features:

  • Implement shopping cart logic via use-shopping-cart.
  • Collect payment and address information from customers who use Apple Pay, Google Pay, Microsoft Pay, and the Payment Request API.
  • Create Payments in a Netlify Functions.
  • Process Stripe webhook events with Netlify Functions to handle fulfillment.

How to run locally

Prerequisites

Follow the steps below to run locally.

1. Clone and configure the sample

git clone https://github.com/stripe-samples/react-elements-netlify-serverless

Copy the .env.example file into a file named .env:

cp .env.example .env

You will need a Stripe account in order to run the demo. Once you set up your account, go to the Stripe developer dashboard to find your API keys.

REACT_APP_STRIPE_PUBLISHABLE_KEY=<replace-with-your-publishable-key>
STRIPE_SECRET_KEY=<replace-with-your-secret-key>

2. Run Netlify Functions locally:

You can run the Netlify Functions locally with Netlify Dev:

npm install
netlify dev

3. Test the Payment Request Button:

To test the Payment Request Button your page must be served via HTTPS. See the full list of requirements in the docs.

4. [Optional] Run a webhook locally:

If you want to test the using-webhooks integration with a local webhook on your machine, you can use the Stripe CLI to easily spin one up.

Make sure to install the CLI and link your Stripe account.

In a separate tab run

stripe listen --forward-to localhost:8888/.netlify/functions/webhooks

Or use the shorthand npm run webhook

The CLI will print a webhook secret key to the console. Set STRIPE_WEBHOOK_SECRET to this value in your .env file.

You should see events logged in the console where the CLI is running.

When you are ready to create a live webhook endpoint, follow our guide in the docs on configuring a webhook endpoint in the dashboard.

💫 Deploy with Netlify

Deploy to Netlify

Authors