How to retrieve the value of a coupon applied to subscriptions using the API?
Scope
I want to display the coupon values for each subscription on my website (portal). How can I fetch them?
How can I get the value of every coupon applied to a subscription?
Summary
To fetch the coupons applied to a subscription, use the Retrieve a subscription API.
You can also use the Estimates API, which shows the estimated amount for creation or renewal of a subscription.
Solution
Coupons applied to a subscription
To fetch the coupons applied to a subscription, use the Retrieve a subscription API for current subscriptions. For subscriptions that have scheduled changes, use the Retrieve with scheduled changes API.
Estimate of a coupon's value for a new subscription or a subscription change
When you sign customers up for subscriptions, use the Estimates API to review the purchase before you sign them up.
These Estimate APIs return coupon details:
Sample estimate cURL:
| CURL Command |
|---|
|
Response:
| JSON Response |
|---|
|