Subscription Components

Update Prepaid Usage Allocation Expiration Date

PUT
/subscriptions/{subscription_id}/components/{component_id}/allocations/{allocation_id}.json

Updates the expiration date for a prepaid usage allocation. This expiration date can be changed after the fact to allow for extending or shortening the allocation's active window.

In order to change a prepaid usage allocation's expiration date, a PUT call must be made to the allocation's endpoint with a new expiration date.

Limitations

A few limitations exist when changing an allocation's expiration date:

  • An expiration date can only be changed for an allocation that belongs to a price point with expiration interval options explicitly set.
  • An expiration date can be changed towards the future with no limitations.
  • An expiration date can be changed towards the past (essentially expiring it) up to the subscription's current period beginning date.

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.

component_id*integer

The Advanced Billing id of the component

allocation_id*integer

The Advanced Billing id of the allocation

Request Body

application/json

allocation?

Response Body

application/json

curl -X PUT "https://example.com/subscriptions/0/components/0/allocations/0.json" \  -H "Content-Type: application/json" \  -d '{    "allocation": {      "expires_at": "2021-05-05T16:00:00"    }  }'
Empty

Delete Prepaid Usage Allocation DELETE

Deletes a prepaid usage allocation. Prepaid Usage components are unique in that their allocations are always additive. In order to reduce a subscription's allocated quantity for a prepaid usage component, each allocation must be destroyed individually via this endpoint. ## Credit Scheme By default, destroying an allocation will generate a service credit on the subscription. This behavior can be modified with the optional `credit_scheme` parameter on this endpoint. The accepted values are: 1. `none`: The allocation will be destroyed and the balances will be updated but no service credit or refund will be created. 2. `credit`: The allocation will be destroyed and the balances will be updated and a service credit will be generated. This is also the default behavior if the `credit_scheme` param is not passed. 3. `refund`: The allocation will be destroyed and the balances will be updated and a refund will be issued along with a Credit Note.

List Usages GET

Lists usages associated with a subscription for a particular metered component. This will display the previously recorded components for a subscription. This endpoint is not compatible with quantity-based components. ## Since Date and Until Date Usage Note: The `since_date` and `until_date` attributes each default to midnight on the date specified. For example, in order to list usages for January 20th, you would need to append the following to the URL. ``` ?since_date=2016-01-20&until_date=2016-01-21 ``` ## Read Usage by Handle Use this endpoint to read the previously recorded components for a subscription. You can now specify either the component id (integer) or the component handle prefixed by "handle:" to specify the unique identifier for the component you are working with.