# Subscription coexisting with metered (per-call) endpoints.
#
# Per-call buyers pay $0.01 every time. Subscribers pay $9.99 once
# and get unlimited access for 30 days. The two endpoints are
# independent — a `pro/quote` subscriber still pays per call if they
# ever hit the metered `/quote` path.
#
# Run locally:
#   pay --sandbox server start with-metered.yml

name: mixed-pricing
subdomain: mixed-pricing
title: 'Per-Call + Subscription'
description: 'Metered and subscription endpoints in the same provider spec.'
category: data
version: v1

routing:
  type: respond
  # type: proxy
  # url: https://api.example.com/

operator:
  currencies:
    usd: ['USDC']
  network: localnet
  fee_payer: true

endpoints:
  # Pay-as-you-go for ad-hoc usage.
  - method: GET
    path: 'api/v1/quote/{symbol}'
    resource: 'quote'
    description: 'Pay-as-you-go stock quote — $0.01 per call.'
    metering:
      dimensions:
        - direction: usage
          unit: requests
          scale: 1
          tiers:
            - price_usd: 0.01

  # Flat-fee subscription for heavy users.
  - method: GET
    path: 'api/v1/pro/quote/{symbol}'
    resource: 'pro-quote'
    description: 'Pro stock quotes — flat $9.99/month subscription.'
    subscription:
      period: '30d'
      price_usd: 9.99
      currency: USDC
