Suspend a subscription

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

Suspends a Subscription resource that matches the customer and subscription ID due to fraud or non-payment.

In Partner Center, this operation can be performed by first selecting a customer. Then, select the subscription in question that you wish to rename. To finish, choose the Suspended button, then select Submit.

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 suspend a customer's subscription, first Get the subscription, then change the subscription's Status property. For information on Status codes, consult [SubscriptionStatus enumeration/dotnet/api/microsoft.store.partnercenter.models.subscriptions.subscriptionstatus). 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;

updatedSubscription = partnerOperations.Customers.ById(selectedCustomerId).Subscriptions.ById(selectedSubscription.Id).Patch(
   new Subscription()
   {
      Status = SubscriptionStatus.Suspended
   });

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 query parameter to suspend the 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 Subscription resource is required in the request body. Ensure that the Status property has been updated.

Request example

PATCH https://api.partnercenter.microsoft.com/v1/customers/<customer-tenant-id>/subscriptions/<id-for-subscription> HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: ca7c39f7-1a80-43bc-90d8-ee7d1cad3831
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
If-Match: <etag>
Content-Type: application/json
Content-Length: 1029
Expect: 100-continue
Connection: Keep-Alive

{
    "Id": "83ef9d05-4169-4ef9-9657-0e86b1eab1de",
    "FriendlyName": "nickname",
    "Quantity": 2,
    "UnitType": "none",
    "ParentSubscriptionId": null,
    "CreationDate": "2015-11-25T06:41:12Z",
    "EffectiveStartDate": "2015-11-24T08:00:00Z",
    "CommitmentEndDate": "2016-12-12T08:00:00Z",
    "Status": "suspended",
    "AutoRenewEnabled": false,
    "BillingType": "none",
    "PartnerId": null,
    "ContractType": "subscription",
    "OrderId": "6183db3d-6318-4e52-877e-25806e4971be",
    "Attributes": {
        "Etag": "<etag>",
        "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 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

PATCH https://api.partnercenter.microsoft.com/v1/customers/<customer-tenant-id>/subscriptions/<subscriptionID> HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-Contract-Version: v1
MS-RequestId: ca7c39f7-1a80-43bc-90d8-ee7d1cad3831
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
Content-Type: application/json
Content-Length: 1029
Expect: 100-continue
Connection: Keep-Alive

{
    "Id": "83ef9d05-4169-4ef9-9657-0e86b1eab1de",
    "FriendlyName": "nickname",
    "Quantity": 2,
    "UnitType": "none",
    "ParentSubscriptionId": null,
    "CreationDate": "2015-11-25T06:41:12Z",
    "EffectiveStartDate": "2015-11-24T08:00:00Z",
    "CommitmentEndDate": "2016-12-12T08:00:00Z",
    "Status": "suspended",
    "AutoRenewEnabled": false,
    "BillingType": "none",
    "PartnerId": null,
    "ContractType": "subscription",
    "Links": {
        "Offer": {
            "Uri": "/v1/offers/0CCA44D6-68E9-4762-94EE-31ECE98783B9",
            "Method": "GET",
            "Headers": []
        },
        "Entitlement": {
            "Uri": "/entitlements?key=<key>",
            "Method": "GET",
            "Headers": []
        },
        "Self": {
            "Uri": "/subscriptions?key=<key>",
            "Method": "GET",
            "Headers": []
        }
    },
    "OrderId": "6183db3d-6318-4e52-877e-25806e4971be",
    "Attributes": {
        "Etag": "<etag>",
        "ObjectType": "Subscription"
    }
}

New commerce example

Request

PATCH https://api.partnercenter.microsoft.com/v1/customers/<customer-tenant-id>/subscriptions/<id-for-subscription> HTTP/1.1 
Authorization: Bearer <token> 
Accept: application/json 
MS-RequestId: 35163960-06c5-4677-9200-7e3b0cc1bb6e 
MS-CorrelationId: bbbb1111-cc22-3333-44dd-555555eeeeee 
Content-Type: application/json 
Content-Length: 1029 
Expect: 100-continue 
Connection: Keep-Alive 

{ 
    "id": "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e", 
    "offerId": "CFQ7TTC0LH18:0001:CFQ7TTC0P0WS", 
    "offerName": "Microsoft 365 Business Basic", 
    "friendlyName": "Microsoft 365 Business Basic", 
    "productType": { 
        "id": "OnlineServicesNCE", 
        "displayName": "OnlineServicesNCE" 
    }, 
    "quantity": 2, 
    "unitType": "Licenses", 
    "hasPurchasableAddons": false, 
    "creationDate": "2024-06-05T19:26:38.3667635Z", 
    "effectiveStartDate": "2024-06-05T00:00:00Z", 
    "commitmentEndDate": "2024-07-04T00:00:00Z", 
    "commitmentEndDateTime": "2024-07-04T23:59:59Z", 
    "cancellationAllowedUntilDate": "2024-06-12T19:27:03.440527Z", 
    "billingCycleEndDate": "2024-07-04T00:00:00Z", 
    "billingCycleEndDateTime": "2024-07-04T23:59:59Z", 
    "status": "suspended", // original value = “active” 
    "autoRenewEnabled": true, 
    "isTrial": false, 
    "billingType": "license", 
    "billingCycle": "monthly", 
    "termDuration": "P1M", 
    "renewalTermDuration": "", 
    "isMicrosoftProduct": true, 
    "partnerId": "", 
    "attentionNeeded": false, 
    "actionTaken": false, 
    "contractType": "subscription", 
    "links": { 
        "product": { 
            "uri": "/products/CFQ7TTC0LH18?country=US", 
            "method": "GET", 
            "headers": [] 
        }, 
        "sku": { 
            "uri": "/products/CFQ7TTC0LH18/skus/0001?country=US", 
            "method": "GET", 
            "headers": [] 
        }, 
        "availability": { 
            "uri": "/products/CFQ7TTC0LH18/skus/0001/availabilities/CFQ7TTC0P0WS?country=US", 
            "method": "GET", 
            "headers": [] 
        }, 
        "self": { 
            "uri": "/customers/a2ce50db-e1d9-4b3b-aa75-6de2bfcdd752/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e", 
            "method": "GET", 
            "headers": [] 
        } 
    }, 

    "publisherName": "Microsoft Corporation", 
    "refundableQuantity": { 
        "totalQuantity": 1, 
        "details": [ 
            { 
                "quantity": 1, 
                "allowedUntilDateTime": "2024-06-14T17:41:13.4675407Z" 
            } 
        ] 
    }, 
    "orderId": "79d9f5e2f43a", 
    "attributes": { 
        "objectType": "Subscription" 
    } 
} 

Response


PATCH https://api.partnercenter.microsoft.com/v1/customers/<customer-tenant-id>/subscriptions/<id-for-subscription> HTTP/1.1 
Authorization: Bearer <token> 
Accept: application/json 
MS-RequestId: 35163960-06c5-4677-9200-7e3b0cc1bb6e 
MS-CorrelationId: bbbb1111-cc22-3333-44dd-555555eeeeee 
Content-Type: application/json 
Content-Length: 1029 
Expect: 100-continue 
Connection: Keep-Alive 

{ 
    "id": "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e", 
    "offerId": "CFQ7TTC0LH18:0001:CFQ7TTC0P0WS", 
    "offerName": "Microsoft 365 Business Basic", 
    "friendlyName": "Microsoft 365 Business Basic", 
    "productType": { 
        "id": "OnlineServicesNCE", 
        "displayName": "OnlineServicesNCE" 
    }, 
    "quantity": 2, 
    "unitType": "Licenses", 
    "hasPurchasableAddons": false, 
    "creationDate": "2024-06-05T19:26:38.3667635Z", 
    "effectiveStartDate": "2024-06-05T00:00:00Z", 
    "commitmentEndDate": "2024-07-04T00:00:00Z", 
    "commitmentEndDateTime": "2024-07-04T23:59:59Z", 
    "cancellationAllowedUntilDate": "2024-06-12T19:27:03.440527Z", 
    "billingCycleEndDate": "2024-07-04T00:00:00Z", 
    "billingCycleEndDateTime": "2024-07-04T23:59:59Z", 
    "status": "suspended",  
    "autoRenewEnabled": false, // autorenew is turned off when the subscription is suspended 
    "isTrial": false, 
    "billingType": "license", 
    "billingCycle": "monthly", 
    "termDuration": "P1M", 
    "renewalTermDuration": "", 
    "isMicrosoftProduct": true, 
    "partnerId": "", 
    "attentionNeeded": false, 
    "actionTaken": false, 
    "contractType": "subscription", 
    "links": { 
        "product": { 
            "uri": "/products/CFQ7TTC0LH18?country=US", 
            "method": "GET", 
            "headers": [] 
        }, 
        "sku": { 
            "uri": "/products/CFQ7TTC0LH18/skus/0001?country=US", 
            "method": "GET", 
            "headers": [] 
        }, 
        "availability": { 
            "uri": "/products/CFQ7TTC0LH18/skus/0001/availabilities/CFQ7TTC0P0WS?country=US", 
            "method": "GET", 
            "headers": [] 
        }, 
        "self": { 
            "uri": "/customers/a2ce50db-e1d9-4b3b-aa75-6de2bfcdd752/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e", 
            "method": "GET", 
            "headers": [] 
        } 
    }, 
    "publisherName": "Microsoft Corporation", 
    "refundableQuantity": null, // seat reduction is not supported in suspended state 
    "orderId": "79d9f5e2f43a", 
    "attributes": { 
        "objectType": "Subscription" 
    } 
}