API · Commerce

Billing & subscriptions

Recurring revenue, one-shot invoices, products + prices, coupons, tax rates. The Stripe-equivalent commerce surface, scoped to Djibouti rails for collection.

12 endpointsprod_ · price_ · sub_

Products & prices

POST/v1/products

Create a product (the thing you sell).

GET/v1/products

List products.

GET/v1/products/{id}

Retrieve a product.

POST/v1/prices

Attach a price (one-time or recurring) to a product.

GET/v1/prices

List prices (filter by product).

Invoices

POST/v1/invoices

Create an invoice (draft).

GET/v1/invoices

List invoices (filter by customer, status).

POST/v1/invoices/{id}/finalize

Finalise — locks the price list and sends the invoice (collection scheduled per subscription).

Subscriptions

POST/v1/subscriptions

Subscribe a customer to one or more prices.

GET/v1/subscriptions

List subscriptions.

DELETE/v1/subscriptions/{id}

Cancel — immediate or at period end (cancel_at_period_end flag).

Sample · monthly subscription

bashbash
# 1) Create the product
curl -X POST https://api.merashub.com/v1/products \
  -H "Authorization: Bearer sk_test_..." \
  -d '{ "name": "Pro plan", "description": "Pro tier monthly" }'

# 2) Attach a price (recurring monthly)
curl -X POST https://api.merashub.com/v1/prices \
  -H "Authorization: Bearer sk_test_..." \
  -d '{
    "product": "prod_...",
    "amount_minor": 250000,
    "currency": "DJF",
    "recurring": { "interval": "month", "interval_count": 1 }
  }'

# 3) Subscribe a customer
curl -X POST https://api.merashub.com/v1/subscriptions \
  -H "Authorization: Bearer sk_test_..." \
  -d '{
    "customer": "cus_...",
    "items": [{ "price": "price_..." }],
    "default_payment_method": "pm_..."
  }'

Collection on Djibouti rails

Recurring charges use the customer's default_payment_method — typically a tokenised mobile-money MSISDN. We try the same provider that the customer paid with on the first subscription invoice; if that provider can't auto-renew (some can't), the invoice is sent for customer confirmation via a hosted link.