Add Custom Attributes to a Subscription
POST https://api.chartmogul.com/v1/subscriptions/{SUBSCRIPTION_UUID}/attributes/custom
Adds custom attributes to a given subscription.
curl -X POST "https://api.chartmogul.com/v1/subscriptions/sub_d1c0c885-add0-48db-8fa9-0bdf5017d6b0/attributes/custom" \
-u YOUR_API_KEY: \
-H "Content-Type: application/json" \
-d '{
"custom": [
{"type": "Boolean", "key": "pre_sold", "value": "true"},
{"type": "String", "key": "renewal_owner", "value": "[email protected]"}
]
}'
{
"custom": {
"pre_sold": true,
"renewal_owner": "[email protected]"
}
}
Subscription set custom attributes. Subscription custom attributes can be added to either subscriptions or subscription sets. This endpoint is for subscriptions only.
Managing custom attributes for subscription sets via the API is not currently supported, but you can do this in the Subscriptions table of a customer profile. API support for subscription sets is coming soon.
If your subscriptions belong to a set, consider managing custom attributes at the set level. Set-level attributes are inherited by all subscriptions in the set and persist when subscriptions change (for example, on a plan switch).
Path parameters
subscription_uuidstring required- The ChartMogul UUID of the subscription. To retrieve subscription UUIDs for a customer, use the List Customer Subscriptions endpoint.
Body parameters
customarray(object) required-
An array containing the custom attributes to add to the subscription. If an attribute with the given key doesn’t exist for the account, it is created automatically. Each item must have a
type,key, andvalue.typestring required-
The data type of the custom attribute. Can be one of
String,Integer,Decimal,Timestamp, orBoolean.Supported data types and their accepted formats.
String– Accepts alphanumeric characters. Maximum of 255 characters allowed.Integer– Accepts only numeric characters.Decimal– Accepts floating point numbers.Timestamp– In the ISO 8601 format.Boolean– Can be one ofTRUE,true,t,1,FALSE,false,f, or0.
keystring required-
The name of the custom attribute. Accepts alphanumeric characters and underscores. Must not contain a
.. valuestring required-
The value of the custom attribute. Must be 255 characters or fewer. All values are string-encoded regardless of type.
Response
custom- A JSON object containing the custom attributes on this subscription after adding.