Update Subscription
PUT
https://api.baremetrics.com/v1/{source_id}/subscriptions/{oid}This allows you to update a Subscription, such as changing plans and addons.
Passing an empty "addons" array will remove all addons from this subscription.
[!CAUTION] It may take a while for your updates to appear in your metrics. There may also be a delay in the data being fully displayed in the GET /subscriptions endpoint.
Path parameters
oidstring requiredYour unique ID for the subscription
source_idstring requiredPlease see Sources
Body
application/jsonplan_oidstring requiredYour unique ID for the plan
occurred_atstring · date-timeA unix timestamp of when this change occurred. Defaults to now
Default
"NOW"addonsarray of objectsIn cents. The OID can be anything you want.
oidstring requiredamountinteger · int32 requiredquantityinteger · int32 required
quantityinteger · int32Default
1discountinteger · int32Integer value (in the same currency as the plan)
Responses
200OK
{
"event": {
"id": "48X4cZ3T25MKkL",
"type": "subscription.updated",
"info": {
"plan_oid": "1476719008009",
"occurred_at": 1480421495,
"quantity": 1,
"addons": [
{
"oid": "addon_1",
"amount": 100,
"quantity": 1
},
{
"oid": "addon_2",
"amount": 50,
"quantity": 1
},
{
"oid": "addon_3",
"amount": 25,
"quantity": 1
}
]
},
"occurred_at": 1480421495,
"received_at": 1480421495
}
}400Bad Request
{
"error": "Error message here"
}