Subscription Groups

Add Subscription to Group

POST
/subscriptions/{subscription_id}/group.json

Adds an existing subscription to a subscription group. For sites making use of the Relationship Billing and Customer Hierarchy features, it is possible to add existing subscriptions to subscription groups.

Passing group parameters with a target containing a type and optional id is all that's needed. When the target parameter specifies a "customer" or "subscription" that is already part of a hierarchy, the subscription will become a member of the customer's subscription group. If the target customer or subscription is not part of a subscription group, a new group will be created and the subscription will become part of the group with the specified target customer set as the responsible payer for the group's subscriptions.

Note: In order to add an existing subscription to a subscription group, it must belong to either the same customer record as the target, or be within the same customer hierarchy.

Rather than specifying a customer, the target parameter could instead simply have a value of

  • "self" which indicates the subscription will be paid for not by some other customer, but by the subscribing customer,
  • "parent" which indicates the subscription will be paid for by the subscribing customer's parent within a customer hierarchy, or
  • "eldest" which indicates the subscription will be paid for by the root-level customer in the subscribing customer's hierarchy.

To create a new subscription into a subscription group, reference the following: Create Subscription in a Subscription Group

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

group?

Response Body

application/json

curl -X POST "https://example.com/subscriptions/0/group.json" \  -H "Content-Type: application/json" \  -d '{    "group": {      "target": {        "type": "subscription",        "id": 32987      },      "billing": {        "accrue": true,        "align_date": true,        "prorate": true      }    }  }'
{  "subscription_group": {    "customer_id": 130690,    "payment_profile": {      "id": 32055,      "first_name": "Marty",      "last_name": "McFly",      "masked_card_number": "XXXX-XXXX-XXXX-1111"    },    "subscription_ids": [      32988,      33060,      32986    ],    "created_at": "2018-08-30T17:14:30-04:00"  }}