Subscriptions
API ReferenceSubscriptionsGet Subscription Price
Get Subscription Price
Get the price of a subscription, so your checkout page can show it before the customer pays. For example, after your server calls Create Subscription, the checkout page has only the subscription ID and client_secret; it uses this endpoint to show "15.00 USD per month" before calling Confirm Subscription.
GET /subscriptions/estimate
Headers
| Header | Type | Required | Description |
|---|---|---|---|
api-key | string | Yes | Your publishable key when called from a browser, or your secret API key from a server. |
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). |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
subscription_id | string | Yes | ID of the subscription. |
client_secret | string | With a publishable key | The subscription's client_secret. It must belong to subscription_id. Not needed with your secret API key. |
Request Example
curl 'https://api.moonlinkpay.com/subscriptions/estimate?subscription_id=sub_fOC8OiljkGOI59gaZJqL&client_secret=sub_fOC8OiljkGOI59gaZJqL_secret_rGax6h0aEyu8owBeID6C' \ -H "api-key: pk_snd_YOUR_PUBLISHABLE_KEY"Response
{"amount": 1500,"currency": "USD","customer_id": "cus_jane_42","line_items": [ { "item_id": "sub_fOC8OiljkGOI59gaZJqL", "item_type": "subscription", "description": "Recurring subscription charge", "amount": 1500, "currency": "USD", "quantity": 1 }]}amount is charged every billing period, in the smallest currency unit.