Skip to content

Stripe Sandbox Setup: Usage-Based Billing for AI SaaSΒ #12

@c9r

Description

@c9r

πŸš€ Stripe Sandbox Configuration Summary

Successfully configured a test Stripe account for usage-based billing suitable for an AI SaaS platform.

βœ… What Was Completed

1. Products Created

  • prod_SyK9qt885gLUbc - "Claude API Pro" (main product)
  • prod_SyKA9GFTn7Vza6 - "Claude API Pro - Monthly Base" (platform fee)
  • prod_SyKBD4NfwWNUny - "Claude API Pro - Token Usage" (metered usage)

2. Pricing Plans Configured

  • pro_monthly_base - $49.00/month recurring base fee
  • pro_overage - $0.002 per 1K tokens (usage-based)

3. Test Customer Setup

  • Customer: Acme AI Corp (cus_SyKBAurM5GKlpW)
  • Email: billing@acme-ai.com
  • Payment Method: Test Visa card attached

4. Test Transactions

  • Created 3 successful test charges totaling $770.50
  • Demonstrated payment failure scenarios (declined, insufficient funds, fraud detection)
  • Processed partial refund of $20.00
  • Current pending balance: $727.26

5. Billing Architecture

Established a two-tier pricing model:

  • Base Monthly Fee: Fixed platform access charge
  • Usage-Based Pricing: Pay-per-token consumption model

πŸ“Š Pricing Structure

Monthly Invoice Example:
- Base Platform Fee: $49.00
- Token Usage (2.5M): $5.00 (2,500 Γ— $0.002)
- Total: $54.00

πŸ”§ Technical Implementation Notes

  • API Version: Stripe API 2025-08-27.basil
  • Test Mode: All operations in sandbox environment
  • Architecture: Products β†’ Prices β†’ Subscriptions β†’ Usage Tracking

πŸ’‘ Key Learnings

  1. Metered Billing Evolution: Stripe now requires Billing Meters API for true metered usage (as of 2025-03-31)
  2. Products vs Prices: One product can have multiple pricing strategies
  3. Usage Tracking: Can be implemented via invoice items or the new Billing Meters API
  4. Subscription Structure: Base fee + usage components work well for SaaS models

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions