Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies To: Partner Center
Update the billing frequency for a software Subscription resource that matches the customer and subscription IDas a scheduled change.
You can also consult the document Manage scheduled changes for new commerce subscriptions to learn how to conduct scheduled changes. To do this operation in Partner Center:
- Choose a customer.
- Pick the Software subscription that you want to update.
- Select Manage renewal to specify options, select Save to save your changes, and then Submit the page.
Prerequisites
Credentials as described in Partner Center authentication. This scenario supports authentication with both standalone App and App+User credentials.
A customer ID (
customer-tenant-id). If you don't know the customer's ID, you can look it up in Partner Center by selecting the Customers workspace, then the customer from the customer list, then Account. On the customer’s Account page, look for the Microsoft ID in the Customer Account Info section. The Microsoft ID is the same as the customer ID (customer-tenant-id).A subscription ID.
C#
To update a customer's software subscription, first Get the subscription, then set the subscription's billingCycle property. Once the change is made, use your IAggregatePartner.Customers collection and call the ById() method. Then call the Subscriptions property, followed by the ById() method. Then, finish by calling the Patch() method.
// IAggregatePartner partnerOperations;
// var selectedCustomerId as string;
// Subscription selectedSubscription;
this.Context.ConsoleHelper.StartProgress("Updating subscription scheduled change");
selectedSubscription.ScheduledNextTermInstructions = new ScheduledNextTermInstructions
{
Product = new ProductTerm
{
ProductId = changeToProductId,
SkuId = changeToSkuId,
AvailabilityId = changeToAvailabilityId,
BillingCycle = changeToBillingCycle,
TermDuration = changeToTermDuration,
},
Quantity = changeToQuantity,
};
var updatedSubscription = subscriptionOperations.Patch(selectedSubscription);
Sample: Console test app. Project: PartnerSDK.FeatureSample Class: UpdateSubscription.cs
REST request
Request syntax
| Method | Request URI |
|---|---|
| PATCH | {baseURL}/v1/customers/{customer-tenant-id}/subscriptions/{id-for-subscription} HTTP/1.1 |
URI parameter
This table lists the required parameters to update billing frequency for a subscription.
| Name | Type | Required | Description |
|---|---|---|---|
| customer-tenant-id | GUID | Y | A GUID corresponding to the customer. |
| id-for-subscription | GUID | Y | A GUID corresponding to the subscription. |
Request headers
For more information, see Partner Center REST headers.
Request body
A full Microsoft Marketplace Subscription resource is required in the request body. Ensure that the AutoRenewEnabled property is updated.
Request example for a software subscription
{
"id": "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
"offerId": "DG7GMGF0DVSV:000P:DG7GMGF0F3Q9",
"offerName": "Windows Server Remote Desktop Services CAL - 1 User CAL – 3 year",
"friendlyName": "Windows Server Remote Desktop Services CAL - 1 User CAL – 3 year",
"productType": {
"id": "Software",
"displayName": "Software"
},
"quantity": 1,
"unitType": "Licenses",
"hasPurchasableAddons": false,
"creationDate": "2021-09-14T16:44:14.1210743Z",
"effectiveStartDate": "2021-09-14T16:44:03.4609789Z",
"commitmentEndDate": "2024-09-13T00:00:00Z",
"cancellationAllowedUntilDate": "2021-10-14T23:59:00Z",
"status": "active",
"autoRenewEnabled": true,
"scheduledNextTermInstructions": {
"product": {
"productId": "DG7GMGF0DVSV",
"skuId": "000P",
"availabilityId": "DG7GMGF0F3Q9",
"billingCycle": "Annual",
"termDuration": "P3Y"
},
"quantity": 1
}, // original value = null
"isTrial": false,
"billingType": "license",
"billingCycle": "triennial",
"termDuration": "P3Y",
"renewalTermDuration": "",
"isMicrosoftProduct": true,
"partnerId": "",
"attentionNeeded": false,
"actionTaken": false,
"contractType": "subscription",
"links": {
"product": {
"uri": "/products/DG7GMGF0DVSV?country=US",
"method": "GET",
"headers": []
},
"sku": {
"uri": "/products/DG7GMGF0DVSV/skus/000P?country=US",
"method": "GET",
"headers": []
},
"availability": {
"uri": "/products/DG7GMGF0DVSV/skus/000P/availabilities/DG7GMGF0F3Q9?country=US",
"method": "GET",
"headers": []
},
"self": {
"uri": "/customers/1f53d7b3-cd04-43a3-a09f-e52f3eb3c205/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
"method": "GET",
"headers": []
}
},
"publisherName": "Microsoft",
"orderId": "123456789101",
"attributes": {
"objectType": "Subscription"
}
}
REST response
If successful, this method returns updated Subscription resource properties in the response body.
Response success and error codes
Each response comes with an HTTP status code that indicates success or failure and other debugging information. Use a network trace tool to read this code, error type, and other parameters. For the full list, see Error Codes.
Response example
{
"id": "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
"offerId": "DG7GMGF0DVSV:000P:DG7GMGF0F3Q9",
"offerName": "Windows Server Remote Desktop Services CAL - 1 User CAL – 3 year",
"friendlyName": "Windows Server Remote Desktop Services CAL - 1 User CAL – 3 year",
"productType": {
"id": "Software",
"displayName": "Software"
},
"quantity": 1,
"unitType": "Licenses",
"hasPurchasableAddons": false,
"creationDate": "2021-09-14T16:44:14.1210743Z",
"effectiveStartDate": "2021-09-14T16:44:03.4609789Z",
"commitmentEndDate": "2024-09-13T00:00:00Z",
"cancellationAllowedUntilDate": "2021-10-14T23:59:00Z",
"status": "active",
"autoRenewEnabled": true,
"scheduledNextTermInstructions": {
"product": {
"productId": "DG7GMGF0DVSV",
"skuId": "000P",
"availabilityId": "DG7GMGF0F3Q9",
"billingCycle": "Annual",
"termDuration": "P3Y"
},
"quantity": 1
}, // original value = null
"isTrial": false,
"billingType": "license",
"billingCycle": "triennial",
"termDuration": "P3Y",
"renewalTermDuration": "",
"isMicrosoftProduct": true,
"partnerId": "",
"attentionNeeded": false,
"actionTaken": false,
"contractType": "subscription",
"links": {
"product": {
"uri": "/products/DG7GMGF0DVSV?country=US",
"method": "GET",
"headers": []
},
"sku": {
"uri": "/products/DG7GMGF0DVSV/skus/000P?country=US",
"method": "GET",
"headers": []
},
"availability": {
"uri": "/products/DG7GMGF0DVSV/skus/000P/availabilities/DG7GMGF0F3Q9?country=US",
"method": "GET",
"headers": []
},
"self": {
"uri": "/customers/1f53d7b3-cd04-43a3-a09f-e52f3eb3c205/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
"method": "GET",
"headers": []
}
},
"publisherName": "Microsoft",
"orderId": "123456789101",
"attributes": {
"objectType": "Subscription"
}
}