Bagikan melalui


Menangguhkan langganan

Berlaku untuk: Pusat Mitra | Pusat Mitra yang dioperasikan oleh 21Vianet | Pusat Mitra untuk Microsoft Cloud untuk Pemerintah AS

Menangguhkan sumber daya Langganan yang cocok dengan PELANGGAN dan ID langganan karena penipuan atau non-pembayaran.

Di Pusat Mitra, operasi ini dapat dilakukan dengan terlebih dahulu memilih pelanggan. Kemudian, pilih langganan yang bersangkutan yang ingin Anda ganti namanya. Untuk menyelesaikannya, pilih tombol Ditangguhkan , lalu pilih Kirim.

Prasyarat

  • Kredensial seperti yang dijelaskan dalam autentikasi Pusat Mitra. Skenario ini mendukung autentikasi dengan kredensial Aplikasi mandiri dan Aplikasi+Pengguna.

  • ID pelanggan (customer-tenant-id). Jika Anda tidak mengetahui ID pelanggan, Anda dapat mencarinya di Pusat Mitra dengan memilih ruang kerja Pelanggan , lalu pelanggan dari daftar pelanggan, lalu Akun. Pada halaman Akun pelanggan, cari ID Microsoft di bagian Info Akun Pelanggan. ID Microsoft sama dengan ID pelanggan (customer-tenant-id).

  • ID langganan.

C#

Untuk menangguhkan langganan pelanggan, pertama-tama Dapatkan langganan, lalu ubah properti Status langganan. Untuk informasi tentang Kode status , lihat [SubscriptionStatus enumeration/dotnet/api/microsoft.store.partnercenter.models.subscriptions.subscriptionstatus). Setelah perubahan dilakukan, gunakan koleksi IAggregatePartner.Customers Anda dan panggil metode ById(). Kemudian panggil properti Langganan, diikuti dengan metode ById(). Kemudian, selesaikan dengan memanggil metode Patch().

// IAggregatePartner partnerOperations;
// var selectedCustomerId as string;
// Subscription selectedSubscription;

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

Sampel: Aplikasi pengujian konsol. Proyek: Kelas PartnerSDK.FeatureSample: UpdateSubscription.cs

Permintaan REST

Minta sintaks

Metode URI Permintaan
PATCH {baseURL}/v1/customers/{customer-tenant-id}/subscriptions/{id-for-subscription} HTTP/1.1

Parameter URI

Tabel ini mencantumkan parameter kueri yang diperlukan untuk menangguhkan langganan.

Nama Tipe Wajib Deskripsi
customer-tenant-id Guid Y GUID yang sesuai dengan pelanggan.
id-for-subscription Guid Y GUID yang sesuai dengan langganan.

Header permintaan

Untuk informasi selengkapnya, lihat Header REST Pusat Mitra.

Isi permintaan

Sumber daya Langganan lengkap diperlukan dalam isi permintaan. Pastikan bahwa properti Status telah diperbarui.

Contoh permintaan

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: ec8f62e5-1d92-47e9-8d5d-1924af105f2c
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"
    }
}

Respons REST

Jika berhasil, metode ini mengembalikan properti sumber daya Langganan yang diperbarui dalam isi respons.

Kode kesalahan dan keberhasilan respons

Setiap respons dilengkapi dengan kode status HTTP yang menunjukkan keberhasilan atau kegagalan dan informasi penelusuran kesalahan tambahan. Gunakan alat pelacakan jaringan untuk membaca kode ini, jenis kesalahan, dan parameter tambahan. Untuk daftar lengkapnya, lihat Kode Kesalahan.

Contoh tanggapan

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: ec8f62e5-1d92-47e9-8d5d-1924af105f2c
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"
    }
}

Contoh perdagangan baru

Permintaan

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: bffa7f30-344e-48f8-be88-f591927dd655 
Content-Type: application/json 
Content-Length: 1029 
Expect: 100-continue 
Connection: Keep-Alive 

{ 
    "id": "0ee4f7f6-b583-403e-81bb-9facbc96ef54", 
    "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/0ee4f7f6-b583-403e-81bb-9facbc96ef54", 
            "method": "GET", 
            "headers": [] 
        } 
    }, 

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

Respons


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: bffa7f30-344e-48f8-be88-f591927dd655 
Content-Type: application/json 
Content-Length: 1029 
Expect: 100-continue 
Connection: Keep-Alive 

{ 
    "id": "0ee4f7f6-b583-403e-81bb-9facbc96ef54", 
    "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/0ee4f7f6-b583-403e-81bb-9facbc96ef54", 
            "method": "GET", 
            "headers": [] 
        } 
    }, 
    "publisherName": "Microsoft Corporation", 
    "refundableQuantity": null, // seat reduction is not supported in suspended state 
    "orderId": "79d9f5e2f43a", 
    "attributes": { 
        "objectType": "Subscription" 
    } 
}