Subscriptions

Activate Subscription

PUT
/subscriptions/{subscription_id}/activate.json

Activates awaiting signup and trialing subscriptions. This feature is only available on the Relationship Invoicing architecture. Subscriptions in a group cannot be activated immediately.

The revert_on_failure parameter controls the behavior upon activation failure.

  • If set to true and something goes wrong i.e. payment fails, the subscription's state does not change. The subscription’s billing period also remains the same.
  • If set to false and something goes wrong i.e. payment fails, the activation continues and enters an end of life state. For trialing subscriptions, that is either trial ended (if the trial is no obligation), past due (if the trial has an obligation), or canceled (if the site has no dunning strategy, or has a strategy that says to cancel immediately). For awaiting signup subscriptions, that is always canceled.

The default activation failure behavior can be configured per activation attempt, or you can set a default value under Config > Settings > Subscription Activation Settings.

Activation Scenarios

Activate Awaiting Signup subscription

  • Given you have a product without trial
  • Given you have a site without dunning strategy
  flowchart LR    AS[Awaiting Signup] --> A{Activate}    A -->|Success| Active    A -->|Failure| ROF{revert_on_failure}    ROF -->|true| AS    ROF -->|false| Canceled
  • Given you have a product with trial
  • Given you have a site with dunning strategy
  flowchart LR    AS[Awaiting Signup] --> A{Activate}    A -->|Success| Trialing    A -->|Failure| ROF{revert_on_failure}    ROF -->|true| AS    ROF -->|false| PD[Past Due]

Activate Trialing subscription

For more information about the behavior of trialing subscriptions, see Trialing Subscriptions. When the revert_on_failure parameter is set to true, the subscription's state remains Trialing; the invoice from activation is voided, and any prepayments and credits applied to the invoice are returned to 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.

Request Body

application/json

revert_on_failure?|

You may choose how to handle the activation failure. true means do not change the subscription’s state and billing period. false means to continue through with the activation and enter an end-of-life state. If this parameter is omitted or null is passed it will default to the value set in the site settings (default: true).

Response Body

application/json

application/json

curl -X PUT "https://example.com/subscriptions/0/activate.json" \  -H "Content-Type: application/json" \  -d '{}'
{  "subscription": {    "id": 0,    "state": "pending",    "balance_in_cents": 0,    "total_revenue_in_cents": 0,    "product_price_in_cents": 0,    "product_version_number": 0,    "current_period_ends_at": "2019-08-24T14:15:22Z",    "next_assessment_at": "2019-08-24T14:15:22Z",    "trial_started_at": "2019-08-24T14:15:22Z",    "trial_ended_at": "2019-08-24T14:15:22Z",    "activated_at": "2019-08-24T14:15:22Z",    "expires_at": "2019-08-24T14:15:22Z",    "created_at": "2019-08-24T14:15:22Z",    "updated_at": "2019-08-24T14:15:22Z",    "cancellation_message": "string",    "cancellation_method": "merchant_ui",    "cancel_at_end_of_period": true,    "canceled_at": "2019-08-24T14:15:22Z",    "current_period_started_at": "2019-08-24T14:15:22Z",    "previous_state": "pending",    "signup_payment_id": 0,    "signup_revenue": "string",    "delayed_cancel_at": "2019-08-24T14:15:22Z",    "coupon_code": "string",    "snap_day": "string",    "payment_collection_method": "automatic",    "customer": {      "first_name": "string",      "last_name": "string",      "email": "string",      "cc_emails": "string",      "organization": "string",      "reference": "string",      "id": 0,      "created_at": "2019-08-24T14:15:22Z",      "updated_at": "2019-08-24T14:15:22Z",      "address": "string",      "address_2": "string",      "city": "string",      "state": "string",      "state_name": "string",      "zip": "string",      "country": "string",      "country_name": "string",      "phone": "string",      "verified": true,      "portal_customer_created_at": "2019-08-24T14:15:22Z",      "portal_invite_last_sent_at": "2019-08-24T14:15:22Z",      "portal_invite_last_accepted_at": "2019-08-24T14:15:22Z",      "tax_exempt": true,      "surcharging": true,      "vat_number": "string",      "vat_country": "string",      "entity_identifier_kind": "vat_eu",      "entity_identifier_value": "string",      "parent_id": 0,      "locale": "string",      "default_subscription_group_uid": "string",      "salesforce_id": "string",      "tax_exempt_reason": "string",      "default_auto_renewal_profile_id": 0,      "maxioid": "string",      "branding_theme_id": 0    },    "product": {      "id": 0,      "name": "string",      "handle": "string",      "description": "string",      "accounting_code": "string",      "request_credit_card": true,      "expiration_interval": 0,      "expiration_interval_unit": "day",      "created_at": "2019-08-24T14:15:22Z",      "updated_at": "2019-08-24T14:15:22Z",      "price_in_cents": 0,      "interval": 0,      "interval_unit": "day",      "initial_charge_in_cents": 0,      "trial_price_in_cents": 0,      "trial_interval": 0,      "trial_interval_unit": "day",      "archived_at": "2019-08-24T14:15:22Z",      "require_credit_card": true,      "return_params": "string",      "taxable": true,      "update_return_url": "string",      "initial_charge_after_trial": true,      "version_number": 0,      "update_return_params": "string",      "product_family": {        "id": 0,        "name": "string",        "handle": "string",        "accounting_code": null,        "description": "string",        "surcharging": true,        "created_at": "2019-08-24T14:15:22Z",        "updated_at": "2019-08-24T14:15:22Z",        "archived_at": "2019-08-24T14:15:22Z"      },      "public_signup_pages": [        {          "id": 0,          "return_url": "string",          "return_params": "string",          "url": "string"        }      ],      "product_price_point_name": "string",      "request_billing_address": true,      "require_billing_address": true,      "require_shipping_address": true,      "tax_code": "string",      "default_product_price_point_id": 0,      "use_site_exchange_rate": true,      "item_category": "string",      "product_price_point_id": 0,      "product_price_point_handle": "string",      "unspsc_code": "string",      "features": [        {          "id": 0,          "feature_template_id": 0,          "feature_key": "string",          "feature_name": "string",          "feature_kind": "access_right",          "value": "string",          "periodicity_interval": 0,          "periodicity_unit": "hour",          "price_point_type": "ProductPricePoint",          "price_point_id": 0,          "archived_at": "2019-08-24T14:15:22Z",          "created_at": "2019-08-24T14:15:22Z",          "updated_at": "2019-08-24T14:15:22Z"        }      ]    },    "credit_card": {      "id": 10088716,      "first_name": "Test",      "last_name": "Subscription",      "masked_card_number": "XXXX-XXXX-XXXX-1",      "card_type": "bogus",      "expiration_month": 1,      "expiration_year": 2022,      "customer_id": 14543792,      "current_vault": "bogus",      "vault_token": "1",      "billing_address": "123 Montana Way",      "billing_city": "Billings",      "billing_state": "MT",      "billing_zip": "59101",      "billing_country": "US",      "customer_vault_token": null,      "billing_address_2": "",      "payment_type": "credit_card",      "site_gateway_setting_id": 1,      "gateway_handle": null    },    "group": {      "uid": "string",      "scheme": 0,      "primary_subscription_id": 0,      "primary": true    },    "bank_account": {      "id": 0,      "first_name": "string",      "last_name": "string",      "customer_id": 0,      "current_vault": "authorizenet",      "vault_token": "string",      "billing_address": "string",      "billing_city": "string",      "billing_state": "string",      "billing_zip": "string",      "billing_country": "string",      "customer_vault_token": "string",      "billing_address_2": "string",      "bank_name": "string",      "masked_bank_routing_number": "string",      "masked_bank_account_number": "string",      "bank_account_type": "checking",      "bank_account_holder_type": "personal",      "payment_type": "bank_account",      "verified": false,      "site_gateway_setting_id": 0,      "gateway_handle": "string",      "created_at": "2019-08-24T14:15:22Z",      "updated_at": "2019-08-24T14:15:22Z"    },    "payment_type": "string",    "referral_code": "string",    "next_product_id": 0,    "next_product_handle": "string",    "coupon_use_count": 0,    "coupon_uses_allowed": 0,    "reason_code": "string",    "automatically_resume_at": "2019-08-24T14:15:22Z",    "coupon_codes": [      "string"    ],    "offer_id": 0,    "payer_id": 0,    "current_billing_amount_in_cents": 0,    "product_price_point_id": 0,    "product_price_point_type": "catalog",    "next_product_price_point_id": 0,    "net_terms": 0,    "stored_credential_transaction_id": 0,    "reference": "string",    "on_hold_at": "2019-08-24T14:15:22Z",    "prepaid_dunning": true,    "coupons": [      {        "code": "string",        "use_count": 0,        "uses_allowed": 0,        "expires_at": "string",        "recurring": true,        "amount_in_cents": 0,        "percentage": "string"      }    ],    "dunning_communication_delay_enabled": true,    "dunning_communication_delay_time_zone": "string",    "receives_invoice_emails": true,    "locale": "string",    "currency": "string",    "scheduled_cancellation_at": "2019-08-24T14:15:22Z",    "credit_balance_in_cents": 0,    "prepayment_balance_in_cents": 0,    "prepaid_configuration": {      "id": 0,      "initial_funding_amount_in_cents": 0,      "replenish_to_amount_in_cents": 0,      "auto_replenish": true,      "replenish_threshold_amount_in_cents": 0    },    "self_service_page_token": "string"  }}