Skip to content

cloudacademy/billing-api-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

billing-api

Simple Billing API for MCP demonstration.

The repo gives you a lightweight FastAPI service with in-memory data stores for customers, invoices, and payments. You can start the server with uvicorn, create customers, issue invoices, record payments, and query the current state without any external dependencies.

Getting Started

  1. Create and activate a virtual environment:

    python -m venv .venv
    source .venv/bin/activate
  2. Install the dependencies:

    pip install -r requirements.txt
  3. Start the API server:

    uvicorn app.main:app --reload
  4. Create a customer:

    curl -X POST http://localhost:8000/customers \
      -H "Content-Type: application/json" \
      -d '{"name": "Example Customer", "email": "customer@example.com"}'
  5. Issue an invoice for that customer:

    curl -X POST http://localhost:8000/invoices \
      -H "Content-Type: application/json" \
      -d '{"customer_id": 1, "amount": 120.0, "currency": "USD", "due_date": "2024-12-31"}'
  6. Record a payment against the invoice:

    curl -X POST http://localhost:8000/payments \
      -H "Content-Type: application/json" \
      -d '{"invoice_id": 1, "amount": 120.0}'
  7. Retrieve the current invoices:

    curl http://localhost:8000/invoices

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%