Create an order

Applies To

  • Partner Center
  • Partner Center operated by 21Vianet
  • Partner Center for Microsoft Cloud Germany
  • Partner Center for Microsoft Cloud for US Government

How to create an order for a customer. For more information about what is currently available to sell, see CSP agreements, price lists, and offers.


  • Credentials as described in Partner Center authentication. This scenario supports authentication with both standalone App and App+User credentials.
  • A customer identifier.
  • An offer identifier.


To create an order for a customer, first instantiate an Order object and set the ReferenceCustomerID property to the customer ID to record the customer. Next, create a list of OrderLineItem objects, and assign the list to the order's LineItems property. Each order line item contains the purchase information for one offer. You must have at least one order line item.

Next, obtain an interface to order operations by calling the IAggregatePartner.Customers.ById method with the customer ID to identify the customer, and then retrieving the interface from the Orders property.

Finally, call the Create or CreateAsync method to create the order.

IAggregatePartner partnerOperations;
string customerId;
string offerId;

var order = new Order()
    ReferenceCustomerId = customerId,
    LineItems = new List<OrderLineItem>()
        new OrderLineItem()
            OfferId = offerId,
            FriendlyName = "new offer purchase",
            Quantity = 5

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

Sample: Console test app. Project: Partner Center SDK Samples Class: CreateOrder.cs


Request syntax

Method Request URI
POST {baseURL}/v1/customers/{customer-id}/orders HTTP/1.1

URI parameters

Use the following path parameter to identify the customer.

Name Type Required Description
customer-id guid Yes A GUID formatted customer-id that identifies the customer.

Request headers

Request body

This table describes the Order properties in the request body.


Name Type Required Description
id string No An order identifier that is supplied upon successful creation of the order.
referenceCustomerId string Yes The customer identifier.
billingCycle string No The frequency with which the partner is billed for this order. The default is "Monthly" and is applied upon successful creation of the order. Supported values are the member names found in BillingCycleType.
Note The annual billing feature is not yet generally available. Support for annual billing is coming soon.
lineItems array of objects Yes An array of OrderLineItem resources.
creationDate string No The date the order was created, in date-time format. Applied upon successful creation of the order.
attributes object No Contains "ObjectType": "Order".

This table describes the OrderLineItem properties in the request body.

Note The partnerIdOnRecord should only be provided when an indirect provider places an order on behalf of an indirect reseller. It's used to store the Microsoft Partner Network ID of the indirect reseller only (never the ID of the indirect provider).


Name Type Required Description
lineItemNumber int Yes Each line item in the collection gets a unique line number, counting up from 0 to count-1.
offerId string Yes The offer identifier.
subscriptionId string No The subscription identifier.
parentSubscriptionId string No Optional. The ID of the parent subscription in an add-on offer. Applies to PATCH only.
friendlyName string No Optional. The friendly name for the subscription defined by the partner to help disambiguate.
quantity int Yes The number of licenses for a license-based subscription.
partnerIdOnRecord string No When an indirect provider places an order on behalf of an indirect reseller, populate this field with the MPN ID of the indirect reseller only (never the ID of the indirect provider). This ensures proper accounting for incentives.
attributes object No Contains "ObjectType":"OrderLineItem".

Request example

Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 57870501-203b-468e-8a63-078a3826d8ec
MS-CorrelationId: 9c272436-538d-4dd4-a421-c811e004784c
X-Locale: en-US
Content-Type: application/json
Content-Length: 405
Expect: 100-continue
Connection: Keep-Alive

    "Id": null,
    "ReferenceCustomerId": "4d3cf487-70f4-4e1e-9ff1-b2bfce8d9f04",
    "BillingCycle": "unknown",
    "LineItems": [{
            "LineItemNumber": 0,
            "OfferId": "84A03D81-6B37-4D66-8D4A-FAEA24541538",
            "SubscriptionId": null,
            "ParentSubscriptionId": null,
            "FriendlyName": "new offer purchase",
            "Quantity": 5,
            "PartnerIdOnRecord": null,
            "Attributes": {
                "ObjectType": "OrderLineItem"
    "CreationDate": null,
    "Attributes": {
        "ObjectType": "Order"


If successful, the response body contains the populated Order resource

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 Partner Center error codes.

Response example

HTTP/1.1 201 Created
Content-Length: 801
Content-Type: application/json; charset=utf-8
MS-CorrelationId: 9c272436-538d-4dd4-a421-c811e004784c
MS-RequestId: 57870501-203b-468e-8a63-078a3826d8ec
MS-CV: VcfS+fqdQUW8Nap6.0
MS-ServerId: 030020525
Date: Thu, 30 Mar 2017 17:43:08 GMT

    "id": "074bd849-9106-405c-9923-fa061839d487",
    "referenceCustomerId": "4d3cf487-70f4-4e1e-9ff1-b2bfce8d9f04",
    "billingCycle": "monthly",
    "lineItems": [{
            "lineItemNumber": 0,
            "offerId": "84A03D81-6B37-4D66-8D4A-FAEA24541538",
            "subscriptionId": "1DA3295E-C59A-476C-A7E7-D7E981FE79BE",
            "friendlyName": "new offer purchase",
            "quantity": 5,
            "links": {
                "subscription": {
                    "uri": "/customers/4d3cf487-70f4-4e1e-9ff1-b2bfce8d9f04/subscriptions/1DA3295E-C59A-476C-A7E7-D7E981FE79BE",
                    "method": "GET",
                    "headers": []
    "creationDate": "2017-03-30T10:43:07.157-07:00",
    "links": {
        "self": {
            "uri": "/customers/4d3cf487-70f4-4e1e-9ff1-b2bfce8d9f04/orders/074bd849-9106-405c-9923-fa061839d487",
            "method": "GET",
            "headers": []
    "attributes": {
        "etag": "eyJpZCI6IjA3NGJkODQ5LTkxMDYtNDA1Yy05OTIzLWZhMDYxODM5ZDQ4NyIsInZlcnNpb24iOjF9",
        "objectType": "Order"