Skip to content

cecilphillip/recipesapi-stripe-billing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Recipes API with Stripe usage based billing

This HTTP API sample shows how to implement usage based billing with Stripe and ASP.NET Core.

The application uses the fixed fee and overage pricing model for subscriptions. A fixed fee is charged upfront and the overage fee is charged at the beginning of the next billing cycle.

Getting Setup

Prerequisites

Running the solution

API Endpoints

All of the recipe resource endpoints are secured with an access token. The application will bootstrap a default set of users, but you can register your own with the POST /auth/register endpoint. Here's a sample payload:

{
  "email": "[email protected]",
  "password": "demo",
  "FullName": "Demo User"
}

You can generate an access token for a user by calling the POST /auth/authenticate endpoint with the following request:

POST /connect/token
Content-Type: application/x-www-form-urlencoded

grant_type=password&[email protected]&password=demo

Available endpoints

  • POST /api/recipes - Create a recipe
  • GET /api/recipes/random - Retrieve a random recipe
  • GET /api/recipes/latest - Retrieve the latest recipes
  • GET /api/recipes/category/{category} - Retrieve all recipes in a category
  • GET /api/recipes/code/{lookupCode} - Retrieve a recipe with the specified lookup code
  • DELETE /api/recipes/code/{lookupCode} - Remove a recipe with the specified lookup code

Available Task Commands

If you install the Task task runner, you can run the following operations against the project using the syntax task <task-name>. For example, task requests:generate will generate a configurable number of request traffic to the API.

requests:authenticate - Get and set an access token for the API

  task requests:authenticate

requests:generate - Generate requests to the API

  task requests:generate

About

Sample HTTP API built with .NET that shows Stripe usage based billing

Topics

Resources

Stars

Watchers

Forks