Change a customer subscription billing cycle

Applies to: Partner Center | Partner Center operated by 21Vianet | Partner Center for Microsoft Cloud for US Government

Tip

This API enables you to modify your billing frequency for legacy subscriptions only.

To modify your billing frequency for New Commerce Experience (NCE) subscriptions and legacy subscriptions, you can use Update a subscription by ID - Partner app developer | Microsoft Learn API.

Updates an Order from monthly to annual billing or from annual to monthly billing.

In Partner Center, this operation can be performed by navigating to a customer's subscription details page. Once there, you will see an option defining the current billing cycle for the subscription with the ability to change and submit it.

Out of scope for this article:

  • Changing the billing cycle for trials
  • Changing the billing cycles for any non-annual term offers (monthly, six-year) & Azure subscriptions
  • Changing the billing cycles for inactive subscriptions
  • Changing billing cycles for Microsoft online services license-based subscriptions

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).

  • An order ID.

C#

To change the frequency of the billing cycle, update the Order.BillingCycle property.

// IAggregatePartner partnerOperations;
// string customerId;
// string offerId;
// string orderId;

var order = new Order()
{
    ReferenceCustomerId = customerId,
    BillingCycle = BillingCycleType.Annual,
    LineItems = new List<OrderLineItem>()
    {
        new OrderLineItem()
        {
            LineItemNumber = 0,
            OfferId = offerId,
            SubscriptionId = "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
            Quantity = 1
        }
    }
};

var createdOrder = partnerOperations.Customers.ById(customerId).Orders.ById(orderId).Patch(order);

REST request

Request syntax

Method Request URI
PATCH {baseURL}/v1/customers/{customer-tenant-id}/orders/{order-id} HTTP/1.1

URI parameter

This table lists the required query parameter to change the quantity of the subscription.

Name Type Required Description
customer-tenant-id GUID Y A GUID formatted customer-tenant-id that identifies the customer
order-id GUID Y The order identifier

Request headers

For more information, see Partner Center REST headers.

Request body

The following tables describe the properties in the request body.

Order

Property Type Required Description
Id string N An order identifier that is supplied upon successful creation of the order
ReferenceCustomerId string Y The customer identifier
BillingCycle string Y Indicates the frequency with which the partner is billed for this order. Supported values are the member names found in BillingCycleType.
LineItems array of objects Y An array of OrderLineItem resources
CreationDate datetime N The date the order was created, in date-time format
Attributes Object N Contains "ObjectType": "OrderLineItem"

OrderLineItem

Property Type Required Description
LineItemNumber number Y The line item number, starting with 0
OfferId string Y The ID of the offer
SubscriptionId string Y The ID of the subscription
FriendlyName string N The friendly name for the subscription defined by the partner to help disambiguate
Quantity number Y The number of licenses or instances
PartnerIdOnRecord string N The PartnerID of the partner of record
Attributes Object N Contains "ObjectType": "OrderLineItem"

Request example

Update to annual billing

PATCH https://api.partnercenter.microsoft.com/v1/customers/4d3cf487-70f4-4e1e-9ff1-b2bfce8d9f04/orders/CF3B0E37-BE0B-4CDD-B584-D1A97D98A922 HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 17a2658e-d2cc-439b-a2f0-2aefd9344fbc
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
X-Locale: en-US
Content-Type: application/json
Host: api.partnercenter.microsoft.com
Content-Length: 414
Expect: 100-continue

{
    "Id": null,
    "ReferenceCustomerId": "4d3cf487-70f4-4e1e-9ff1-b2bfce8d9f04",
    "BillingCycle" : "Annual",
    "LineItems": [{
            "LineItemNumber": 0,
            "OfferId": "2828BE95-46BA-4F91-B2FD-0BEF192ECF60",
            "SubscriptionId": "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
            "FriendlyName": "Some friendly name",
            "Quantity": 2,
            "PartnerIdOnRecord": null,
            "Attributes": {
                "ObjectType": "OrderLineItem"
            }
        }
    ],
    "CreationDate": null,
    "Attributes": {
        "ObjectType": "Order"
    }
}

REST response

If successful, this method returns the updated subscription order in the response body.

Response success and error codes

Each response comes with an HTTP status code that indicates success or failure and additional debugging information. Use a network trace tool to read this code, error type, and additional parameters. For the full list, see Error Codes.

Response example

HTTP/1.1 200 OK
Content-Length: 1135
Content-Type: application/json; charset=utf-8
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
MS-RequestId: 17a2658e-d2cc-439b-a2f0-2aefd9344fbc
MS-CV: WtFy3zI8V0u2lnT9.0
MS-ServerId: 020021921
Date: Wed, 25 Jan 2017 23:01:08 GMT

{
    "id": "cf3b0e37-be0b-4cdd-b584-d1a97d98a922",
    "referenceCustomerId": "4d3cf487-70f4-4e1e-9ff1-b2bfce8d9f04",
    "billingCycle": "Annual",
    "lineItems": [{
            "lineItemNumber": 0,
            "offerId": "195416C1-3447-423A-B37B-EE59A99A19C4",
            "subscriptionId": "bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f",
            "friendlyName": "new offer purchase",
            "quantity": 5,
            "links": {
                "subscription": {
                    "uri": "/customers/4d3cf487-70f4-4e1e-9ff1-b2bfce8d9f04/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f",
                    "method": "GET",
                    "headers": []
                }
            }
        },
        {
            "lineItemNumber": 1,
            "offerId": "2828BE95-46BA-4F91-B2FD-0BEF192ECF60",
            "subscriptionId": "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
            "friendlyName": "Some friendly name",
            "quantity": 2,
            "links": {
                "subscription": {
                    "uri": "/customers/4d3cf487-70f4-4e1e-9ff1-b2bfce8d9f04/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
                    "method": "GET",
                    "headers": []
                }
            }
        }
    ],
    "creationDate": "2017-01-25T14:53:12.093-08:00",
    "links": {
        "self": {
            "uri": "/customers/4d3cf487-70f4-4e1e-9ff1-b2bfce8d9f04/orders/cf3b0e37-be0b-4cdd-b584-d1a97d98a922",
            "method": "GET",
            "headers": []
        }
    },
    "attributes": {
        "etag": "eyJpZCI6ImNmM2IwZTM3LWJlMGItNGNkZC1iNTg0LWQxYTk3ZDk4YTkyMiIsInZlcnNpb24iOjJ9",
        "objectType": "Order"
    }
}