API Docs
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

HeaderTypeRequiredDescription
api-keystringYesYour publishable key when called from a browser, or your secret API key from a server.
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).

Query Parameters

ParameterTypeRequiredDescription
subscription_idstringYesID of the subscription.
client_secretstringWith a publishable keyThe 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.