Subscriptions

Apply Coupons to Subscription

POST
/subscriptions/{subscription_id}/add_coupon.json

Applies one or more coupon codes to an existing subscription.

An existing subscription can accommodate multiple discounts/coupon codes. This is only applicable if each coupon is stackable. For more information on stackable coupons, we recommend reviewing our coupon documentation.

Query Parameters vs Request Body Parameters

Passing in a coupon code as a query parameter will add the code to the subscription, completely replacing all existing coupon codes on the subscription.

For this reason, using this query parameter on this endpoint has been deprecated in favor of using the request body parameters as described below. When passing in request body parameters, the list of coupon codes will simply be added to any existing list of codes on the subscription.

Authorization

BasicAuth
AuthorizationBasic <token>

The username is a Maxio Chargify API key. The password is x.

In: header

Path Parameters

subscription_id*integer

The Chargify id of the subscription.

Query Parameters

code?string
Deprecated

A code for the coupon that would be applied to a subscription

Request Body

application/json

codes?array<string>

Response Body

application/json

application/json

curl -X POST "https://example.com/subscriptions/0/add_coupon.json" \  -H "Content-Type: application/json" \  -d '{    "codes": [      "COUPON_1",      "COUPON_2"    ]  }'
{  "subscription": {    "id": 21607180,    "state": "active",    "trial_started_at": null,    "trial_ended_at": null,    "activated_at": "2018-04-20T14:20:57-05:00",    "created_at": "2018-04-20T14:20:57-05:00",    "updated_at": "2018-05-11T13:53:44-05:00",    "expires_at": null,    "balance_in_cents": 49000,    "current_period_ends_at": "2018-05-12T11:33:03-05:00",    "next_assessment_at": "2018-05-12T11:33:03-05:00",    "canceled_at": null,    "cancellation_message": null,    "next_product_id": null,    "cancel_at_end_of_period": false,    "payment_collection_method": "remittance",    "snap_day": null,    "cancellation_method": null,    "current_period_started_at": "2018-05-11T11:33:03-05:00",    "previous_state": "active",    "signup_payment_id": 237154761,    "signup_revenue": "0.00",    "delayed_cancel_at": null,    "coupon_code": "COUPONA",    "total_revenue_in_cents": 52762,    "product_price_in_cents": 100000,    "product_version_number": 2,    "payment_type": "credit_card",    "referral_code": "x45nc8",    "coupon_use_count": 0,    "coupon_uses_allowed": 1,    "reason_code": null,    "automatically_resume_at": null,    "coupon_codes": [      "COUPONA",      "COUPONB"    ],    "customer": {      "id": 21259051,      "first_name": "K",      "last_name": "C",      "organization": "",      "email": "example@chargify.com",      "created_at": "2018-04-20T14:20:57-05:00",      "updated_at": "2018-04-23T15:29:28-05:00",      "reference": null,      "address": "",      "address_2": "",      "city": "",      "state": "",      "zip": "",      "country": "",      "phone": "",      "portal_invite_last_sent_at": "2018-04-20T14:20:59-05:00",      "portal_invite_last_accepted_at": null,      "verified": false,      "portal_customer_created_at": "2018-04-20T14:20:59-05:00",      "cc_emails": "",      "tax_exempt": false    },    "product": {      "id": 4581816,      "name": "Basic",      "handle": "basic",      "description": "",      "accounting_code": "",      "request_credit_card": true,      "expiration_interval": null,      "expiration_interval_unit": "never",      "created_at": "2017-11-02T15:00:11-05:00",      "updated_at": "2018-04-10T09:02:59-05:00",      "price_in_cents": 100000,      "interval": 1,      "interval_unit": "month",      "initial_charge_in_cents": 100000,      "trial_price_in_cents": 1000,      "trial_interval": 10,      "trial_interval_unit": "month",      "archived_at": null,      "require_credit_card": true,      "return_params": "",      "taxable": false,      "update_return_url": "",      "tax_code": "",      "initial_charge_after_trial": false,      "version_number": 2,      "update_return_params": "",      "product_family": {        "id": 1025627,        "name": "My Product Family",        "description": "",        "handle": "acme-products",        "accounting_code": null      },      "public_signup_pages": [        {          "id": 333589,          "return_url": "",          "return_params": "",          "url": "https://general-goods.chargifypay.com/subscribe/hbwtd98j3hk2/basic"        },        {          "id": 335926,          "return_url": "",          "return_params": "",          "url": "https://general-goods.chargifypay.com/subscribe/g366zy67c7rm/basic"        },        {          "id": 345555,          "return_url": "",          "return_params": "",          "url": "https://general-goods.chargifypay.com/subscribe/txqyyqk7d8rz/basic"        },        {          "id": 345556,          "return_url": "",          "return_params": "",          "url": "https://general-goods.chargifypay.com/subscribe/2zss3qpf4249/basic"        }      ]    },    "credit_card": {      "id": 14839830,      "first_name": "John",      "last_name": "Doe",      "masked_card_number": "XXXX-XXXX-XXXX-1",      "card_type": "bogus",      "expiration_month": 1,      "expiration_year": 2028,      "customer_id": 21259051,      "current_vault": "bogus",      "vault_token": "1",      "billing_address": null,      "billing_city": null,      "billing_state": null,      "billing_zip": "99999",      "billing_country": null,      "customer_vault_token": null,      "billing_address_2": null,      "payment_type": "credit_card"    }  }}

Preview Subscription POST

Previews a subscription by POSTing the same JSON or XML as for a subscription creation. The "Next Billing" amount and "Next Billing" date are represented in each Subscriber's Summary. This endpoint does not create a subscription; it is meant to serve as a prediction. For more information, see [Subscriber Interface Overview](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscriber-Interface-Overview). ## Subscriptions can now work independently from the catalog If you have the new [Catalog experience](https://maxio-test-wp.pages.dev/support/announcements/2026-announcements#new-catalog-experience-and-terminology) enabled, you can create subscriptions without a `product_id` or `product_handle` using POST /subscriptions, building them entirely from components. A valid subscription must include at least one active component with: - a positive `allocated_quantity`, - a positive `unit_balance`, or - 'enabled: true' (for on/off components) `component_id` can be provided as a numeric ID or in handle: format. If `trial_interval` and `trial_interval_unit` are included, they are applied at creation. In the response, product and product price point fields are null, and component details are returned instead. This functionality is supported in the API, but is not currently supported in SDKs. ## Taxable Subscriptions This endpoint previews taxes applicable to a purchase. For taxes to be previewed, the following conditions must be met: + Taxes must be configured on the subscription + The preview must be for the purchase of a taxable product or component, or combination of the two. + The subscription payload must contain a full billing or shipping address to calculate tax For more information about creating taxable previews, see [Taxes](https://maxio.zendesk.com/hc/en-us/sections/24287012349325-Taxes). You do **not** need to include a card number to generate tax information when you are previewing a subscription. However, when you actually want to create the subscription, you must include the credit card information if you want the billing address to be stored. The billing address and the credit card information are stored together within the payment profile object. Also, you cannot send a billing address without payment profile information, as the address is stored on the card. You can pass shipping and billing addresses and still decide not to calculate taxes. To do that, pass `skip_billing_manifest_taxes: true` attribute. ## Non-taxable Subscriptions If you'd like to calculate subscriptions that do not include tax, you can leave off the billing information.

Remove Coupon from Subscription DELETE

Removes a coupon from an existing subscription. For more information on the expected behavior of removing a coupon from a subscription, see [Coupons and Subscriptions](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions#removing-a-coupon).