Skip to content

A sample showing a Stripe Checkout integration built with Blazor and ASP.NET Core

License

Notifications You must be signed in to change notification settings

cecilphillip-stripe/stripe-checkout-events-sample

Repository files navigation

Events Storefront sample integration using Stripe Checkout

What's in the box

This sample is split into a few projects

Requirements

Running the demo

Step 1: Obtain your Stripe Keys 🕵🏽‍♂️

Before running the code, you'll need to retrieve your Stripe Secret Key from your account dashboard.

  • Log in to your Stripe Dashboard
  • Make sure you're in test mode. The toggle is located at the top right corner of the page.
  • Click on the Developers button, then select API Keys in the left menu
  • Under Standard Keys, reveal and copy your Secret key.

You can learn more about API Keys and Modes at this link => https://stripe.com/docs/keys

"Stripe": {
    "PublishableKey": "",
    "SecretKey": "",
    "WebhookSecrety": ""
  },

Step 2: Obtain your Stripe Webhook Key 🕵🏽‍♂️

Use the stripe listen command with the --forward-to flag to stream stripe events from your account in test mode to your local webhook endpoint.

stripe listen --forward-to localhost:5276/webhook

This command will return the webhook secret that you'll add to the WebhookSecret configuration key in your appsettings.json file.

Step 3: Seeding data into the Stripe Dashboard

The appsettings.json file has a configuration property called SeedProductData. Set it to true to initiate seeding product and pricing data.

Step 4: Run the code 👨🏽‍💻

Navigate into the src/ directory

cd  src/

Run the project

> dotnet build
> dotnet run --project StripeEventsCheckout.ApiServer

By default, the application should start running on http://localhost:5276

[Optional] Run the application in Docker 👨🏽‍💻

The repo contains Dockerfiles and docker-compose files to quickly spin up the project running in containers on your local Docker instance.

To run the containers locally, you'll need to have Docker installed on your machine.

File Listing

Service Local Port(s)
Stripe Events Web App 5276
Mongo DB 27017
Seq 8191

Run the containers

Run the following command from the root directory of the project

> docker compose -f docker-compose-app.yml -f docker-compose-infra.yml up

About

A sample showing a Stripe Checkout integration built with Blazor and ASP.NET Core

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •