Subscriptions

The billing surface: customers, prices, subscriptions. Subscriptions are active immediately — no invoices, no billing clock. The current period computes from the price interval. No money moves.

Customers

MethodPathAction
POST / GET/v1/customersCreate (email, name, description, metadata); list
GET / POST / DELETE/v1/customers/:idRetrieve; update; delete (active subscriptions cancel, the id stays resolvable as { "deleted": true })

Prices

MethodPathAction
POST / GET/v1/pricesCreate (currency + unit_amount required; recurring[interval] = day | week | month | year makes it recurring, omit for one-time; nickname, product freeform); list (active filter)
GET / POST/v1/prices/:idRetrieve; update (active, nickname, metadata — amount and currency are immutable)

Subscriptions

MethodPathAction
POST / GET/v1/subscriptionsCreate (customer required; items[0][price] required, active recurring prices only, one currency; items[0][quantity] default 1); list (customer, status filters)
GET / POST / DELETE/v1/subscriptions/:idRetrieve; update (cancel_at_period_end, metadata); cancel immediately

Period math: current_period_start = created; current_period_end = created + interval × interval_count (day 86400s, week 604800s, month 30 days, year 365 days). Referencing an unknown customer or price answers 400 with the No such ... message.

# Customer → price → subscription
curl https://api.mockpay.net/v1/customers \
  -u mock_sk_...: -d email=swan@example.com

curl https://api.mockpay.net/v1/prices \
  -u mock_sk_...: \
  -d currency=usd -d unit_amount=1500 \
  -d "recurring[interval]=month"

curl https://api.mockpay.net/v1/subscriptions \
  -u mock_sk_...: \
  -d customer=cus_... \
  -d "items[0][price]=price_..." -d "items[0][quantity]=2"

Event types

  • customer.created / customer.updated / customer.deleted
  • price.created / price.updated
  • customer.subscription.created / customer.subscription.updated / customer.subscription.deleted