Create an order for a customer of an indirect reseller

Applies To

  • Partner Center

How to create an order for a customer of an indirect reseller.


  • Credentials as described in Partner Center authentication. This scenario supports authentication with App+User credentials only.
  • The customer identifier.
  • The offer identifier of the item to purchase.
  • The tenant identifier of the indirect reseller.


To create an order for a customer of an indirect reseller, start by getting a collection of the indirect resellers that have a relationship with the signed-in partner. Then set a local variable to the item in the collection that matches the indirect reseller ID. This is so you can access the reseller's MpnId property when you create the order.

Next, instantiate an Order object and set the ReferenceCustomerID property to the customer identifier in order to record the customer. Then, 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. Be sure to populate the PartnerIdOnRecord property in each line item with the MPN ID of the indirect reseller.

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 retrieve the interface from the Orders property.

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

// IAggregatePartner partnerOperations;
// string customerId;
// string offerId;
// string indirectResellerId;

// Get the indirect resellers with a relationship to the signed-in partner.
var indirectResellers = partnerOperations.Relationships.Get(PartnerRelationshipType.IsIndirectCloudSolutionProviderOf);

// Find the matching reseller in the collection.
var selectedIndirectReseller = (indirectResellers != null && indirectResellers.Items.Any()) ?
    indirectResellers.Items.FirstOrDefault(reseller => reseller.Id.Equals(indirectResellerId, StringComparison.OrdinalIgnoreCase)) :

// Prepare the order and populate the PartnerIdOnRecord with the reseller's Microsoft Partner Network Id. 
var order = new Order()
    ReferenceCustomerId = customerId,
    LineItems = new List<OrderLineItem>()
        new OrderLineItem()
            OfferId = offerId,
            FriendlyName = "New offer purchase.",
            Quantity = 5,
            PartnerIdOnRecord = selectedIndirectReseller != null ? selectedIndirectReseller.MpnId : null

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

Sample: Console test appProject: Partner Center SDK Samples Class: PlaceOrderForCustomer.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 string Yes A GUID formatted string 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.


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.
Note  Failure to provide the reseller MPN ID does not cause the order to fail. However, the reseller is not recorded and as a consequence incentive calculations may not include the sale.
attributes object No Contains "ObjectType":"OrderLineItem".

Request example

Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 02109f46-3ff2-4be4-9f37-b2eb6d58d542
MS-CorrelationId: 85195ae6-3de5-4978-abd4-7be2fbfe4c84
X-Locale: en-US
Content-Type: application/json
Content-Length: 410
Expect: 100-continue

    "Id": null,
    "ReferenceCustomerId": "c501c3c4-d776-40ef-9ecf-9cefb59442c1",
    "BillingCycle": "unknown",
    "LineItems": [{
            "LineItemNumber": 0,
            "OfferId": "DB2E705F-B82A-4024-A3D5-D88E12F2DB35",
            "SubscriptionId": null,
            "ParentSubscriptionId": null,
            "FriendlyName": "New offer purchase.",
            "Quantity": 5,
            "PartnerIdOnRecord": "4847383",
            "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: 831
Content-Type: application/json; charset=utf-8
MS-CorrelationId: 85195ae6-3de5-4978-abd4-7be2fbfe4c84
MS-RequestId: 02109f46-3ff2-4be4-9f37-b2eb6d58d542
MS-CV: Nd3Oum/L5EywtKQK.0
MS-ServerId: 020021921
Date: Mon, 10 Apr 2017 23:02:24 GMT

    "id": "3eddcac6-63b2-4c40-b0b6-f47e18301492",
    "referenceCustomerId": "c501c3c4-d776-40ef-9ecf-9cefb59442c1",
    "billingCycle": "monthly",
    "lineItems": [{
            "lineItemNumber": 0,
            "offerId": "DB2E705F-B82A-4024-A3D5-D88E12F2DB35",
            "subscriptionId": "42226ED6-070A-4E0F-B80C-4CDFB3E97AA7",
            "friendlyName": "New offer purchase.",
            "quantity": 5,
            "partnerIdOnRecord": "4847383",
            "links": {
                "subscription": {
                    "uri": "/customers/c501c3c4-d776-40ef-9ecf-9cefb59442c1/subscriptions/42226ED6-070A-4E0F-B80C-4CDFB3E97AA7",
                    "method": "GET",
                    "headers": []
    "creationDate": "2017-04-10T16:02:25.983-07:00",
    "links": {
        "self": {
            "uri": "/customers/c501c3c4-d776-40ef-9ecf-9cefb59442c1/orders/3eddcac6-63b2-4c40-b0b6-f47e18301492",
            "method": "GET",
            "headers": []
    "attributes": {
        "etag": "eyJpZCI6IjNlZGRjYWM2LTYzYjItNGM0MC1iMGI2LWY0N2UxODMwMTQ5MiIsInZlcnNpb24iOjF9",
        "objectType": "Order"