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
| Method | Path | Action |
|---|
POST / GET | /v1/customers | Create (email, name, description, metadata); list |
GET / POST / DELETE | /v1/customers/:id | Retrieve; update; delete (active subscriptions cancel, the id stays resolvable as { "deleted": true }) |
Prices
| Method | Path | Action |
|---|
POST / GET | /v1/prices | Create (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/:id | Retrieve; update (active, nickname, metadata — amount and currency are immutable) |
Subscriptions
| Method | Path | Action |
|---|
POST / GET | /v1/subscriptions | Create (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/:id | Retrieve; 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.deletedprice.created / price.updatedcustomer.subscription.created / customer.subscription.updated / customer.subscription.deleted