Create a change on a subscription
Updating the quantity of an item
In this guide, we will walk through how to create a change proposal for an existing subscription and change a quantity of a line item.
Prerequisites
- The subscription id of the subscription to change
This example uses a product called "Platform user" with a quantity of 5 in the initial subscription.
Create change proposal
Example POST /contracts//proposals?type=change
The response will be the newly created change proposal with a unique id.
Update start date for the change
Change proposals have a start date for when the change should take effect.
Example PATCH /api/latest/proposals/{proposal_id} request:
{
"startDate": '2024-09-18'
}
Update quantity on an item
Subscriptions and proposal are made up of one or many items that each represent the pricing, quantity and schedule for a product. To update the quantity for a particular item you must first identify the line item to be updated.
For example to find the item id corresponding for a particular product id do the following:
const itemId = proposal.proposalItems
.find(item => item.product.id === 'd9bbb5b1-656b-4527-98d1-b8ca125b40f4')
.id;
Now you can update the quantity on that line item.
Example PATCH /api/latest/data/proposal-items/{item_id} request:
{
"quantity": 8
}
This will update the change proposal with the new quantity and will handle any prorating needed.
Accept the change
The change can be accepting by calling the accept endpoint for the proposal
Updated 4 months ago