API Docs
Subscriptions
API ReferenceSubscriptionsRetrieve Subscription

Retrieve Subscription

Get a subscription with its billing state and latest invoice.

GET /subscriptions/:subscription_id

Headers

HeaderTypeRequiredDescription
api-keystringYesYour secret API key.
X-Profile-IdstringNoNot 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

ParameterTypeDescription
subscription_idstringRequired. 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

FieldDescription
statuscreated, active, unpaid, paused, cancelled or failed. See Statuses.
amount, currencyThe price charged every period.
billing_cycle_countRenewals completed so far. 0 means only the signup payment.
next_billing_atWhen the next renewal is charged. null unless the subscription is active.
cancel_at_period_endtrue when the subscription will end at the close of the current period instead of renewing.
total_billing_cycles, remaining_billing_cyclesSet for a fixed number of payments: the total, and how many are left.
invoiceThe 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.
paymentNot included on this endpoint. Look the payment up with invoice.payment_intent_id.