Subscriptions
API ReferenceSubscriptionsRetrieve Subscription
Retrieve Subscription
Get a subscription with its billing state and latest invoice.
GET /subscriptions/:subscription_id
Headers
| Header | Type | Required | Description |
|---|---|---|---|
api-key | string | Yes | Your secret API key. |
X-Profile-Id | string | No | Not needed: the subscription's own profile is used. If you send it, it must be that profile, otherwise the request fails with IR_37 (subscription not found). |
Path Parameters
| Parameter | Type | Description |
|---|---|---|
subscription_id | string | Required. ID of the subscription. |
Request Example
curl 'https://api.moonlinkpay.com/subscriptions/sub_YZQbEYEnzrjzBorzniG3' \ -H "api-key: snd_YOUR_API_KEY"Response
{"id": "sub_YZQbEYEnzrjzBorzniG3","merchant_reference_id": "order_1001","status": "active","customer_id": "cus_jane_42","profile_id": "pro_YOUR_PROFILE_ID","merchant_id": "merchant_1234567890","client_secret": "sub_YZQbEYEnzrjzBorzniG3_secret_whu3tA0bowghriOUr1Ke","amount": 1500,"currency": "USD","total_billing_cycles": 12,"remaining_billing_cycles": 11,"billing_cycle_count": 0,"next_billing_at": "2026-12-03T18:01:10.526Z","cancel_at_period_end": false,"plan_id": null,"item_price_id": null,"payment": null,"invoice": { "id": "invoice_8wGNC5ismdSdKrTe3czi", "subscription_id": "sub_YZQbEYEnzrjzBorzniG3", "payment_intent_id": "sub_7f12f1899ad117a4798ca211_0_0", "payment_method_id": "pm_lyJgCvOfYecQKaH1acPk", "amount": 1500, "currency": "USD", "status": "invoice_paid", "billing_cycle_count": 0, "period_start": "2026-11-03T18:01:10.526Z", "period_end": "2026-12-03T18:01:10.526Z", "attempt_count": 0, "last_error_code": null, "last_error_message": null}}Response Fields
| Field | Description |
|---|---|
status | created, active, unpaid, paused, cancelled or failed. See Statuses. |
amount, currency | The price charged every period. |
billing_cycle_count | Renewals completed so far. 0 means only the signup payment. |
next_billing_at | When the next renewal is charged. null unless the subscription is active. |
cancel_at_period_end | true when the subscription will end at the close of the current period instead of renewing. |
total_billing_cycles, remaining_billing_cycles | Set for a fixed number of payments: the total, and how many are left. |
invoice | The latest invoice. status is invoice_created (not charged yet: a two-step signup before confirm), payment_pending (a charge is in progress, for example during 3D Secure), invoice_paid or payment_failed (the last attempt was declined); period_start and period_end are the period it pays for; attempt_count is how many charges were tried; last_error_code and last_error_message say why the last attempt failed. |
payment | Not included on this endpoint. Look the payment up with invoice.payment_intent_id. |