Skip to content

Latest commit

 

History

History
60 lines (42 loc) · 2.34 KB

readme.md

File metadata and controls

60 lines (42 loc) · 2.34 KB

Application Overview

This sample application shows a simple user flow for performing the following actions:

  • Home page displays premium content if the logged-in user has a subscription
  • User can view their account details page to see their subscription status
  • From the account details page, the user can:
    • Purchase a new subscription
    • Cancel (Pause) an existing subscription
    • Reinstate a paused subscription
    • View all invoices

alt-text

Getting Started

Login to your Stripe dashboard and create a Product and Plan. Then add your development keys and and the product and plan keys to your secrets file:

{
  "StripeSettings:PublicKey": "...",
  "StripeSettings:PrivateKey": "...",
  "StripeSettings:WebhookSecret": "...",
  "StripeSettings:DefaultProductKey": "...",
  "StripeSettings:DefaultProductName": "Your great product",
  "StripeSettings:DefaultPlanKey": "...",
  "StripeSettings:DefaultPlanName": "Monthly",
  "StripeSettings:DefaultPlanAmountInCents": "800",
  "StripeSettings:CheckoutSuccessRedirectUrl": "https://localhost:55965/Subscription/UpgradeCB?sessionId={CHECKOUT_SESSION_ID}"
}

Webhooks

Install the Stripe CLI and run the following command to start listening.

.\stripe.exe listen --forward-to localhost:55965/Webhook/Handle

Using the Stripe API

The Stripe API Reference contains helpful articles and API reference documentation for working Products, Plans, Subscriptions, Customers, and Payments.

The how to Set up a subscription article on the Stripe Docs website explains how to create subscriptions in code.

You can also get some useful examples for creating card elements at the following link on GitHub

Useful Links