Skip to main content

Overview

A subscription is a recurring billing agreement that links a customer to one of your products at a fixed interval. Hyparrow tracks the billing period, the next billing date, and a complete payment history for each subscription. A subscription always belongs to a customer and a product, and bills in one of these intervals:
Base URL: https://api.hyparrow.cloud/api/v1Authenticate every request with both headers:
Use https://sandbox.hyparrow.cloud/api/v1 with pk_test_ keys to dry-run a full billing cycle — generate a virtual account, simulate a transfer, and confirm the status moves to active without moving real money.
Subscription amounts in API responses are in naira (e.g. 4500.00), derived from the product price. Where you reconcile against transactions or webhook deliveries elsewhere in the Hyparrow API, money is denominated in kobo (1 naira = 100 kobo).

Lifecycle

A subscription moves through a small set of states:
1

pending_payment

Created but not yet paid. No service period has started. This is the initial status of every new subscription.
2

active

The first payment has been collected. currentPeriodStart, currentPeriodEnd, and nextBillingAt are set, and the subscription will bill again at the interval you chose.
3

canceled

Cancelled by you via the cancel endpoint. Billing stops; no further renewals are attempted.
4

expired

A renewal was missed and the grace window (graceDays, default 3) elapsed without payment.

Create a subscription

POST /subscriptions/
The subscription starts in pending_payment. To activate it, collect the first payment — usually by generating a virtual account (below).

Generate a virtual account to collect payment

A virtual account (VA) is a temporary, dedicated bank account number. Your customer transfers the exact subscription amount to it; once the transfer lands, Hyparrow records the payment and moves the subscription to active. POST /subscriptions/{subscriptionId}/generate-va expiryMinutes must be one of 10, 15, or 30.
1

Generate the account

Call generate-va. You receive an account number, bank name, and an expiry timestamp.
2

Show it to the customer

Display the account details and the exact amount. Transfers must arrive before expiresAt.
3

Wait for confirmation

When the transfer settles, the subscription becomes active and a payment is recorded. If you have a webhook configured, a subscription.payment.completed event is delivered.
Customers must transfer the exact amount. The account expires at expiresAt; after that you must generate a fresh one.

Fetch the active virtual account

GET /subscriptions/{subscriptionId}/va returns the current active VA (useful for re-displaying details), or 404 if none is active.

Mark a subscription as paid

For payments collected outside the VA flow (for example a confirmed manual bank transfer), record the payment directly with POST /subscriptions/{subscriptionId}/pay. This advances the billing period and activates the subscription.

Cancel a subscription

POST /subscriptions/{subscriptionId}/cancel stops all future billing.

Get and list subscriptions

The list endpoint supports page, limit, and a status filter, and returns pagination metadata:

Payment history

GET /subscriptions/{subscriptionId}/payments lists every recorded payment for a subscription, paginated. Each entry shows the amount, reference, payer, payment source, and the billing period it covers.
To be notified of renewals automatically rather than polling this endpoint, configure a webhook URL and listen for the subscription.payment.completed event. See the Webhooks guide.