共用方式為


購買 Azure 節省方案

適用于:合作夥伴中心

本文涵蓋在合作夥伴中心購買 Azure 節省方案的 API 體驗,並提供 Azure 節省方案特有的 要求/回應範例

必要條件

認證,如合作夥伴中心驗證所述。 此案例支援使用應用程式加上使用者的認證來進行驗證。

客戶識別碼 (customer-tenant-id)。 如果您不知道客戶的識別碼,您可以選取 [客戶] 工作區,然後從客戶清單中選取客戶,然後從客戶清單中查詢該識別碼,然後查閱合作夥伴中心。 在客戶的 [帳戶] 頁面上,尋找 [客戶帳戶資訊] 區段中的 [Microsoft 識別碼] 。 Microsoft 識別碼與客戶識別碼 () customer-tenant-id 相同。

若要使用合作夥伴中心 API 為客戶購買 Azure 節省方案,您必須擁有至少一個作用中 Azure 訂用帳戶的客戶 Azure 方案。 如何購買 Azure 方案

探索 Azure 節省方案

購買 Azure 節省方案之前,請先完成下列步驟:

  1. 識別並擷取您想要購買的產品和 SKU。 您可以先列出產品和 SKU,或者如果您已經知道產品和 SKU 的識別碼,請選取它們。 若要在下列 API 中檢視 Azure 節省方案值,在下列 API 的路由中需要客戶識別碼,而且該客戶必須有 Azure 方案。

  2. 擷取SKU的可用性。 下訂單時,您需要可用性的 CatalogItemId 。 若要取得此值,請使用下列其中一個 API:

針對 Azure 節省方案, 客戶) 取得產品 (的 SKU 清單 ,並使用 SKU 識別碼 和可用性 API 回應取得 SKU 會傳回 SKU 的 minimumPurchaseCommitment 。 這是可針對指定期限每小時進行的最低承諾。 這僅適用于 Azure 節省方案,不適用於其他產品系列。

購買 Azure 節省方案

若要提交 Azure 節省方案訂單,請完成下列步驟:

  1. 建立購物車來保存您想要購買的目錄專案集合。 當您建立 購物車時, 購物車明細專案 會根據可以在相同 訂單中一起購買的專案自動分組。
  2. 請查看購物車。 簽出購物車會導致 訂單建立。

在 API 要求中,合作夥伴必須在建立或更新購物車並建立訂單時指定下列參數。 PurchaseCommitment 是 Azure 節省方案的新價值。

  • 範圍:可能的值包括單一、共用
  • EntitlementId:單一範圍所需的 Azure 訂用帳戶識別碼
  • SubscriptionId:共用範圍所需的 Azure 方案識別碼
  • PurchaseCommitment:一或三年計算服務上認可的固定每小時金額。

Azure 節省方案需要布建內容,包括範圍和訂用帳戶識別碼/權利識別碼,以及購買承諾用量,包括金額、粒紋和貨幣。

檢視和管理 Azure 節省方案

合作夥伴可以檢視在合作夥伴中心購買的 Azure 節省方案。 如同保留實例,合作夥伴可以繼續使用 Azure 入口網站進行購買後管理動作。 如需管理 Azure 節省方案的詳細資訊,請參閱 管理 Azure 節省方案 - Microsoft 成本管理

依識別碼取得訂用 帳戶和 取得客戶的訂 用帳戶 API 中,會傳回名為 SubscriptionLineItem 的資料模型。 在訂用帳戶回應中,合作夥伴會看到下列 Azure 節省方案的屬性:

  • unitType: 值為權益
  • billingType: 值為權益
  • lineItems: 明細專案包含特定 Azure 節省方案訂用帳戶的購買詳細資料 (,例如範圍和 PurchaseCommitment) 。
  • productOrderId: 特定產品購買 (識別碼,例如保留或 Azure 節省方案) 。

注意

針對透過 Azure 入口網站購買的 Azure 節省方案,訂用帳戶 API 不會傳回訂單識別碼。

Azure 節省方案的發票和對帳

合作夥伴可以造訪 CSP 中的節省方案對帳和計費 ,以瞭解如何反映其每月帳單對帳檔案中的節省量。

要求/回應範例

探索 API 範例

依照識別碼取得產品

回應

{  
    "id": "DZH318Z09V6F",  
    "title": "Azure savings plan",  
    "description": "Flexible pricing model offering lower prices compared to On-Demand pricing, in exchange for a specific usage commitment",  
    "productType": {  
        "id": "Azure",  
        "displayName": "Azure",  
        "subType": {  
            "id": "SavingsPlan",  
            "displayName": "SavingsPlan"  
        }  
    },  
    "isMicrosoftProduct": true,  
    "publisherName": "Microsoft Corporation",  
    "links": {  
        "skus": {  
            "uri": "/products/DZH318Z09V6F/skus?country=US",  
            "method": "GET",  
            "headers": []  
        },  
        "self": {  
            "uri": "/products/DZH318Z09V6F?country=US",  
            "method": "GET",  
            "headers": []  
        }  
    }  
}  

識別碼取得 SKU

回應

{  
    "id": "0001",  
    "productId": "DZH318Z09V6F",  
    "title": "Compute savings plan, 1 Year",  
    "description": "Compute savings plan, 1 Year",  
    "minimumQuantity": 1,  
    "maximumQuantity": 1,  
    "minimumPurchaseCommitment": {  
        "grain": "Hourly",  
        "currencyCode": {  
            "code": "USD",  
            "symbol": "$"  
        },  
        "amount": "0.001"  
    },  
    "isTrial": false,  
    "supportedBillingCycles": [  
        "one_time",  
        "monthly"  
    ],  
    "purchasePrerequisites": [  
        "MicrosoftCloudAgreement"  
    ],  
    "inventoryVariables": [],  
    "provisioningVariables": [],  
    "actions": [  
        "Refund"  
    ],  
    "dynamicAttributes": {  
        "isMicrosoftProduct": true,  
        "armSkuName": "Compute_Savings_Plan",  
        "duration": "1year",  
        "termDuration": "P1Y",  
        "internal": false  
    },  
    "links": {  
        "availabilities": {  
            "uri": "/products/DZH318Z09V6F/skus/0001/availabilities?country=US",  
            "method": "GET",  
            "headers": []  
        },  
        "self": {  
            "uri": "/products/DZH318Z09V6F/skus/0001?country=US",  
            "method": "GET",  
            "headers": []  
        }  
    }  
}

依識別碼取得可用性

回應

{  
    "id": "DZH318Z0BLD3",  
    "productId": "DZH318Z09V6F",  
    "skuId": "0001",  
    "catalogItemId": "DZH318Z09V6F:0001:DZH318Z0BLD3",  
    "defaultCurrency": {  
        "code": "USD",  
        "symbol": "$"  
    },  
    "segment": "commercial",  
    "country": "US",  
    "isPurchasable": true,  
    "isRenewable": false,  
    "renewalInstructions": [],  
    "terms": [  
        {  
            "duration": "P1Y",  
            "description": "1year"  
        }  
    ],  
    "links": {  
        "self": {  
            "uri": "/products/DZH318Z09V6F/skus/0001/availabilities/DZH318Z0BLD3?country=US",  
            "method": "GET",  
            "headers": []  
        }  
    },  
    "product": {  
        "id": "DZH318Z09V6F",  
        "title": "Azure savings plan",  
        "description": "Flexible pricing model offering lower prices compared to On-Demand pricing, in exchange for a specific usage commitment",  
        "productType": {  
            "id": "Azure",  
            "displayName": "Azure",  
            "subType": {  
                "id": "SavingsPlan",  
                "displayName": "SavingsPlan"  
            }  
        },  
        "isMicrosoftProduct": true,  
        "publisherName": "Microsoft Corporation",  
        "links": {  
            "skus": {  
                "uri": "/products/DZH318Z09V6F/skus?country=US",  
                "method": "GET",  
                "headers": []  
            },  
            "self": {  
                "uri": "/products/DZH318Z09V6F?country=US",  
                "method": "GET",  
                "headers": []  
            }  
        }  
    },  
    "sku": {  
        "id": "0001",  
        "productId": "DZH318Z09V6F",  
        "title": "Compute savings plan, 1 Year",  
        "description": "Compute savings plan, 1 Year",  
        "minimumQuantity": 1,  
        "maximumQuantity": 1,  
        "minimumPurchaseCommitment": {  
            "grain": "Hourly",  
            "currencyCode": {  
                "code": "USD",  
                "symbol": "$"  
            },  
            "amount": "0.001"  
        },  
        "isTrial": false,  
        "supportedBillingCycles": [  
            "one_time",  
            "monthly"  
        ],  
        "purchasePrerequisites": [  
            "MicrosoftCloudAgreement"  
        ],  
        "inventoryVariables": [],  
        "provisioningVariables": [],  
        "actions": [  
            "Refund"  
        ],  
        "dynamicAttributes": {  
            "isMicrosoftProduct": true,  
            "armSkuName": "Compute_Savings_Plan",  
            "duration": "1year",  
            "termDuration": "P1Y",  
            "internal": false  
        },  
        "links": {  
            "availabilities": {  
                "uri": "/products/DZH318Z09V6F/skus/0001/availabilities?country=US",  
                "method": "GET",  
                "headers": []  
            },  
            "self": {  
                "uri": "/products/DZH318Z09V6F/skus/0001?country=US",  
                "method": "GET",  
                "headers": []  
            }  
        }  
    }  
} 

取得客戶) 的產品 (SKU 清單

回應

{  
    "totalCount": 2,  
    "items": [  
        {  
            "id": "0001",  
            "productId": "DZH318Z09V6F",  
            "title": "Compute savings plan, 1 Year",  
            "description": "Compute savings plan, 1 Year",  
            "minimumQuantity": 1,  
            "maximumQuantity": 1,  
            "minimumPurchaseCommitment": {  
                "grain": "Hourly",  
                "currencyCode": {  
                    "code": "USD",  
                    "symbol": "$"  
                },  
                "amount": "0.001"  
            },  
            "isTrial": false,  
            "supportedBillingCycles": [  
                "one_time",  
                "monthly"  
            ],  
            "purchasePrerequisites": [  
                "MicrosoftCloudAgreement"  
            ],  
            "inventoryVariables": [],  
            "provisioningVariables": [],  
            "actions": [  
                "Refund"  
            ],  
            "dynamicAttributes": {  
                "isMicrosoftProduct": true,  
                "armSkuName": "Compute_Savings_Plan",  
                "duration": "1year",  
                "termDuration": "P1Y",  
                "internal": false  
            },  
            "links": {  
                "availabilities": {  
                    "uri": "/products/DZH318Z09V6F/skus/0001/availabilities",  
                    "method": "GET",  
                    "headers": []  
                },  
                "self": {  
                    "uri": "/products/DZH318Z09V6F/skus/0001",  
                    "method": "GET",  
                    "headers": []  
                }  
            }  
        },  
        {  
            "id": "0002",  
            "productId": "DZH318Z09V6F",  
            "title": "Compute savings plan, 3 Years",  
            "description": "Compute savings plan, 3 Years",  
            "minimumQuantity": 1,  
            "maximumQuantity": 1,  
            "minimumPurchaseCommitment": {  
                "grain": "Hourly",  
                "currencyCode": {  
                    "code": "USD",  
                    "symbol": "$"  
                },  
                "amount": "0.001"  
            },  
            "isTrial": false,  
            "supportedBillingCycles": [  
                "one_time",  
                "monthly"  
            ],  
            "purchasePrerequisites": [  
                "MicrosoftCloudAgreement"  
            ],  
            "inventoryVariables": [],  
            "provisioningVariables": [],  
            "actions": [  
                "Refund"  
            ],  
            "dynamicAttributes": {  
                "isMicrosoftProduct": true,  
                "armSkuName": "Compute_Savings_Plan",  
                "duration": "3years",  
                "termDuration": "P3Y",  
                "internal": false  
            },  
            "links": {  
                "availabilities": {  
                    "uri": "/products/DZH318Z09V6F/skus/0002/availabilities?country=US",  
                    "method": "GET",  
                    "headers": []  
                },  
                "self": {  
                    "uri": "/products/DZH318Z09V6F/skus/0002?country=US",  
                    "method": "GET",  
                    "headers": []  
                }  
            }  
        }  
    ],  
    "links": {  
        "self": {  
            "uri": "/products/DZH318Z09V6F/skus?country=US",  
            "method": "GET",  
            "headers": []  
        }  
    },  
    "attributes": {  
        "objectType": "Collection"  
    }  
}  

依國家/地區取得產品 (的 SKU 清單)

回應

{  
    "totalCount": 2,  
    "items": [  
        {  
            "id": "0001",  
            "productId": "DZH318Z09V6F",  
            "title": "Compute savings plan, 1 Year",  
            "description": "Compute savings plan, 1 Year",  
            "minimumQuantity": 1,  
            "maximumQuantity": 1,  
            "minimumPurchaseCommitment": {  
                "grain": "Hourly",  
                "currencyCode": {  
                    "code": "USD",  
                    "symbol": "$"  
                },  
                "amount": "0.001"  
            },  
            "isTrial": false,  
            "supportedBillingCycles": [  
                "one_time",  
                "monthly"  
            ],  
            "purchasePrerequisites": [  
                "MicrosoftCloudAgreement"  
            ],  
            "inventoryVariables": [],  
            "provisioningVariables": [],  
            "actions": [  
                "Refund"  
            ],  
            "dynamicAttributes": {  
                "isMicrosoftProduct": true,  
                "armSkuName": "Compute_Savings_Plan",  
                "duration": "1year",  
                "termDuration": "P1Y",  
                "internal": false  
            },  
            "links": {  
                "availabilities": {  
                    "uri": "/products/DZH318Z09V6F/skus/0001/availabilities?country=US",  
                    "method": "GET",  
                    "headers": []  
                },  
                "self": {  
                    "uri": "/products/DZH318Z09V6F/skus/0001?country=US",  
                    "method": "GET",  
                    "headers": []  
                }  
            }  
        },  
        { 
            "id": "0002",  
            "productId": "DZH318Z09V6F",  
            "title": "Compute savings plan, 3 Years",  
            "description": "Compute savings plan, 3 Years",  
            "minimumQuantity": 1,  
            "maximumQuantity": 1,  
            "minimumPurchaseCommitment": {  
                "grain": "Hourly",  
                "currencyCode": {  
                    "code": "USD",  
                    "symbol": "$"  
                },  
                "amount": "0.001"  
            },  
            "isTrial": false,  
            "supportedBillingCycles": [  
                "one_time",  
                "monthly"  
            ],  
            "purchasePrerequisites": [  
                "MicrosoftCloudAgreement"  
            ],  
            "inventoryVariables": [],  
            "provisioningVariables": [],  
            "actions": [  
                "Refund"  
            ],  
            "dynamicAttributes": {  
                "isMicrosoftProduct": true,  
                "armSkuName": "Compute_Savings_Plan",  
                "duration": "3years",  
                "termDuration": "PY",  
                "internal": false  
            },  
            "links": {  
                "availabilities": {  
                    "uri": "/products/DZH318Z09V6F/skus/0002/availabilities?country=US",  
                    "method": "GET",  
                    "headers": []  
                },  
                "self": {  
                    "uri": "/products/DZH318Z09V6F/skus/0002?country=US",  
                    "method": "GET",  
                    "headers": []  
                }  
            }  
        }  
    ],  
    "links": {  
        "self": {  
            "uri": "/products/DZH318Z09V6F/skus?country=US",  
            "method": "GET",  
            "headers": []  
        }  
    },  
    "attributes": {  
        "objectType": "Collection"  
    }  
}

依客戶) 取得 SKU (可用性清單

回應

 {  
    "totalCount": 1,  
    "items": [  
        {  
            "id": "DZH318Z0BLD3",  
            "productId": "DZH318Z09V6F",  
            "skuId": "0001",  
            "catalogItemId": "DZH318Z09V6F:0001:DZH318Z0BLD3",  
            "defaultCurrency": {  
                "code": "USD",  
                "symbol": "$"  
            },  
            "segment": "commercial",  
            "country": "US",  
            "isPurchasable": true,  
            "isRenewable": false,  
            "renewalInstructions": [],  
            "terms": [  
                {  
                    "duration": "P1Y",  
                    "description": "1year"  
                }  
            ],  
            "links": {  
                "self": {  
                    "uri": "/products/DZH318Z09V6F/skus/0001/availabilities/DZH318Z0BLD3?country=US",  
                    "method": "GET",  
                    "headers": []  
                }  
            },  
            "product": {  
                "id": "DZH318Z09V6F",  
                "title": "Azure savings plan",  
                "description": "Flexible pricing model offering lower prices compared to On-Demand pricing, in exchange for a specific usage commitment",  
                "productType": {  
                    "id": "Azure",  
                    "displayName": "Azure",  
                    "subType": {  
                        "id": "SavingsPlan",  
                        "displayName": "SavingsPlan"  
                    }  
                },  
                "isMicrosoftProduct": true,  
                "publisherName": "Microsoft Corporation",  
                "links": {  
                    "skus": {  
                        "uri": "/products/DZH318Z09V6F/skus?country=US",  
                        "method": "GET",  
                        "headers": []  
                    }, 
                    "self": {  
                        "uri": "/products/DZH318Z09V6F?country=US",  
                        "method": "GET",  
                        "headers": []  
                    }  
                }  
            },  
            "sku": {  
                "id": "0001",  
                "productId": "DZH318Z09V6F",  
                "title": "Compute savings plan, 1 Year",  
                "description": "Compute savings plan, 1 Year",  
                "minimumQuantity": 1,  
                "maximumQuantity": 1,  
                "minimumPurchaseCommitment": {  
                    "grain": "Hourly",  
                    "currencyCode": {  
                        "code": "USD",  
                        "symbol": "$"  
                    },  
                    "amount": "0.001"  
                },  
                "isTrial": false,  
                "supportedBillingCycles": [  
                    "one_time",  
                    "monthly"  
                ],  
                "purchasePrerequisites": [  
                    "MicrosoftCloudAgreement"  
                ],  
                "inventoryVariables": [],  
                "provisioningVariables": [],  
                "actions": [  
                    "Refund"  
                ],  
                "dynamicAttributes": {  
                    "isMicrosoftProduct": true,  
                    "armSkuName": "Compute_Savings_Plan",  
                    "duration": "1year",  
                    "termDuration": "P1Y",  
                    "internal": false  
                },  
                "links": {  
                    "availabilities": {  
                        "uri": "/products/DZH318Z09V6F/skus/0001/availabilities?country=US",  
                        "method": "GET",  
                        "headers": []  
                    },  
                    "self": {  
                        "uri": "/products/DZH318Z09V6F/skus/0001?country=US",  
                        "method": "GET",  
                        "headers": []  
                    }  
                }  
            }  
        }  
    ],  
    "links": {  
        "self": {  
            "uri": "/products/DZH318Z09V6F/skus/0001/availabilities?country=US",  
            "method": "GET",  
            "headers": []  
        }  
    },  
    "attributes": {  
        "objectType": "Collection"  
    }  
}

依國家/地區取得 SKU (可用性清單)

回應

{  
    "totalCount": 1,  
    "items": [  
        {  
            "id": "DZH318Z0BLD3",  
            "productId": "DZH318Z09V6F",  
            "skuId": "0001",  
            "catalogItemId": "DZH318Z09V6F:0001:DZH318Z0BLD3",  
            "defaultCurrency": {  
                "code": "USD",  
                "symbol": "$"  
            },  
            "segment": "commercial",  
            "country": "US",  
            "isPurchasable": true,  
            "isRenewable": false,  
            "renewalInstructions": [],  
            "terms": [  
                {  
                    "duration": "P1Y",  
                    "description": "1year"  
                }  
            ],  
            "links": {  
                "self": {  
                    "uri": "/products/DZH318Z09V6F/skus/0001/availabilities/DZH318Z0BLD3?country=US",  
                    "method": "GET",  
                    "headers": []  
                }  
            },  
            "product": {  
                "id": "DZH318Z09V6F",  
                "title": "Azure savings plan",  
                "description": "Flexible pricing model offering lower prices compared to On-Demand pricing, in exchange for a specific usage commitment",  
                "productType": {  
                    "id": "Azure",  
                    "displayName": "Azure",  
                    "subType": {  
                        "id": "SavingsPlan",  
                        "displayName": "SavingsPlan"  
                    }  
                },  
                "isMicrosoftProduct": true,  
                "publisherName": "Microsoft Corporation",  
                "links": {  
                    "skus": {  
                        "uri": "/products/DZH318Z09V6F/skus?country=US",  
                        "method": "GET",  
                        "headers": []  
                    },  
                    "self": {  
                        "uri": "/products/DZH318Z09V6F?country=US",  
                        "method": "GET",  
                        "headers": []  
                    }  
                }  
            },  
            "sku": {  
                "id": "0001",  
                "productId": "DZH318Z09V6F",  
                "title": "Compute savings plan, 1 Year",  
                "description": "Compute savings plan, 1 Year",  
                "minimumQuantity": 1,  
                "maximumQuantity": 1,  
                "minimumPurchaseCommitment": {  
                    "grain": "Hourly",  
                    "currencyCode": {  
                        "code": "USD",  
                        "symbol": "$"  
                    },  
                    "amount": "0.001"  
                },  
                "isTrial": false,  
                "supportedBillingCycles": [  
                    "one_time",  
                    "monthly"  
                ],  
                "purchasePrerequisites": [  
                    "MicrosoftCloudAgreement"  
                ],  
                "inventoryVariables": [],  
                "provisioningVariables": [],  
                "actions": [  
                    "Refund"  
                ],  
                "dynamicAttributes": {  
                    "isMicrosoftProduct": true,  
                    "armSkuName": "Compute_Savings_Plan",  
                    "duration": "1year",  
                    "termDuration": "P1Y",  
                    "internal": false  
                },  
                "links": {  
                    "availabilities": {  
                        "uri": "/products/DZH318Z09V6F/skus/0001/availabilities?country=US",  
                        "method": "GET",  
                        "headers": []  
                    },  
                    "self": {  
                        "uri": "/products/DZH318Z09V6F/skus/0001?country=US",  
                        "method": "GET",  
                        "headers": []  
                    }  
                }  
            }  
        }  
    ],  
    "links": {  
        "self": {  
            "uri": "/products/DZH318Z09V6F/skus/0001/availabilities?country=US",  
            "method": "GET",  
            "headers": []  
        }  
    },  
    "attributes": {  
        "objectType": "Collection"  
    }  
}  

購買 API 範例

建立購物車

要求

{  
    "lineItems": [  
        {  
            "id": 0,  
            "catalogItemId": "DZH318Z09V6F:0001:DZH318Z0BLD3",  
            "quantity": 1,  
            "billingCycle": "one_time",  
            "termDuration": "P1Y",  
            "provisioningContext": {  
                "scope": “shared", // scope options are shared, single  
                "subscriptionId": "0350d130-4d3d-4005-aca0-cf84f0ab0d4a", // Azure plan ID, this is required for shared scope 
            },  
            "purchaseCommitment": {  
                "amount": 0.05,  
                "grain": "hourly",  
                "currency": "usd"  
            }  
        }  
    ]  
}

回應

{  
    "id": "66e3591e-faad-445c-b930-4ccdbf54c43f",  
    "creationTimestamp": "2023-05-18T05:15:16.8466842Z",  
    "lastModifiedTimestamp": "2023-05-18T05:15:16.8467621Z",  
    "expirationTimestamp": "2023-05-25T05:15:23.6893847Z",  
    "lastModifiedUser": "9db12087-fbc3-481c-8965-73d44ff88e27",  
    "status": "Active",  
    "lineItems": [  
        {  
            "id": 0,  
            "catalogItemId": "DZH318Z09V6F:0001:DZH318Z0BLD3",  
            "quantity": 1,  
            "currencyCode": "USD",  
            "billingCycle": "one_time",  
            "termDuration": "P1Y",  
            "provisioningContext": {  
                "scope": "shared",  
                "subscriptionId": "0350d130-4d3d-4005-aca0-cf84f0ab0d4a"  
            },  
            "orderGroup": "0",  
            "purchaseCommitment": {  
                "amount": 0.05,  
                "currency": "usd",  
                "grain": "hourly"  
            }  
        }  
    ],  
    "links": {  
        "self": {  
            "uri": "/customers/6f4ce4d8-f42e-45e0-8661-92ad6ac9d003/carts/66e3591e-faad-445c-b930-4ccdbf54c43f",  
            "method": "GET",  
            "headers": []  
        }  
    },  
    "attributes": {  
        "objectType": "Cart"  
    }  
}

取得購物車

回應

 {  
    "id": "66e3591e-faad-445c-b930-4ccdbf54c43f",  
    "creationTimestamp": "2023-05-18T05:15:16.8466842Z",  
    "lastModifiedTimestamp": "2023-05-18T05:15:16.8467621Z",  
    "expirationTimestamp": "2023-05-25T05:15:23.6893847Z",  
    "lastModifiedUser": "9db12087-fbc3-481c-8965-73d44ff88e27",  
    "status": "Active",  
    "lineItems": [  
        {  
            "id": 0,  
            "catalogItemId": "DZH318Z09V6F:0001:DZH318Z0BLD3",  
            "quantity": 1,  
            "currencyCode": "USD",  
            "billingCycle": "one_time",  
            "termDuration": "P1Y",  
            "provisioningContext": {  
                "scope": "shared",  
                "subscriptionId": "0350d130-4d3d-4005-aca0-cf84f0ab0d4a"  
            },  
            "orderGroup": "0",  
            "purchaseCommitment": {  
                "amount": 0.05,  
                "currency": "usd",  
                "grain": "hourly"  
            }  
        }  
    ],  
    "links": { 
        "self": {  
            "uri": "/customers/6f4ce4d8-f42e-45e0-8661-92ad6ac9d003/carts/66e3591e-faad-445c-b930-4ccdbf54c43f",  
            "method": "GET",  
            "headers": []  
        }  
    },  
    "attributes": {  
        "objectType": "Cart"  
    }  
}  

更新購物車

要求

{  
    "id": "66e3591e-faad-445c-b930-4ccdbf54c43f",  
    "creationTimestamp": "2023-05-18T05:15:16.8466842Z",  
    "lastModifiedTimestamp": "2023-05-18T05:15:16.8467621Z",  
    "expirationTimestamp": "2023-05-25T05:15:23.6893847Z",  
    "lastModifiedUser": "9db12087-fbc3-481c-8965-73d44ff88e27",  
    "status": "Active",  
    "lineItems": [  
        {  
            "id": 0,  
            "catalogItemId": "DZH318Z09V6F:0001:DZH318Z0BLD3",  
            "quantity": 1,  
            "currencyCode": "USD",  
            "billingCycle": "one_time",  
            "termDuration": "P1Y",  
            "provisioningContext": {  
                "scope": “single", // previously was “shared”  
                “entitlementId": "cdd17cc7-14fe-4445-8650-1f52de705851“ // entitlementId equates to subscriptionId key for the scoped Azure subscription 
            },  
            "orderGroup": "0",  
            "purchaseCommitment": {  
                "amount": 0.05,  
                "currency": "usd",  
                "grain": "hourly"  
            }  
        }  
    ],  
    "links": {  
        "self": {  
            "uri": "/customers/6f4ce4d8-f42e-45e0-8661-92ad6ac9d003/carts/66e3591e-faad-445c-b930-4ccdbf54c43f",  
            "method": "GET",  
            "headers": []  
        }  
    },  
    "attributes": {  
        "objectType": "Cart"  
    }  
}

回應

{  
    "id": "66e3591e-faad-445c-b930-4ccdbf54c43f",  
    "creationTimestamp": "2023-05-18T05:15:16.8466842Z",  
    "lastModifiedTimestamp": "2023-05-18T05:15:16.8467621Z",  
    "expirationTimestamp": "2023-05-25T05:15:23.6893847Z",  
    "lastModifiedUser": "9db12087-fbc3-481c-8965-73d44ff88e27",  
    "status": "Active",  
    "lineItems": [  
        {  
            "id": 0,  
            "catalogItemId": "DZH318Z09V6F:0001:DZH318Z0BLD3",  
            "quantity": 1,  
            "currencyCode": "USD",  
            "billingCycle": "one_time",  
            "termDuration": "P1Y",  
            "provisioningContext": {  
                "scope": “single",  
                “entitlementId": "cdd17cc7-14fe-4445-8650-1f52de705851“   
            },  
            "orderGroup": "0",  
            "purchaseCommitment": {  
                "amount": 0.05,  
                "currency": "usd",  
                "grain": "hourly"  
            }  
        }  
    ],  
    "links": {  
        "self": {  
            "uri": "/customers/6f4ce4d8-f42e-45e0-8661-92ad6ac9d003/carts/66e3591e-faad-445c-b930-4ccdbf54c43f",  
            "method": "GET",  
            "headers": []  
        }  
    },  
    "attributes": {  
        "objectType": "Cart"  
    }  
}

結帳購物車

回應

{  
    "orders": [  
        {  
            "id": "2b912b339251",  
            "alternateId": "2b912b339251",  
            "referenceCustomerId": "6f4ce4d8-f42e-45e0-8661-92ad6ac9d003",  
            "billingCycle": "one_time",  
            "currencyCode": "USD",  
            "currencySymbol": "US$",  
            "lineItems": [  
                {  
                    "lineItemNumber": 0,  
                    "provisioningContext": {  
                        "scope": "single",  
                        "entitlementId": "cdd17cc7-14fe-4445-8650-1f52de705851"  
                    },  
                    "offerId": "DZH318Z09V6F:0001:DZH318Z0BLD3",  
                    "termDuration": "P1Y",  
                    "transactionType": "New",  
                    "friendlyName": "Compute savings plan, 1 Year",  
                    "quantity": 1,  
                    "pricing": {  
                        "listPrice": 438.0,  
                        "discountedPrice": 438.0,  
                        "proratedPrice": 438.0,  
                        "price": 438.0,  
                        "extendedPrice": 438.0  
                    },  
                    "purchaseCommitment": {  
                        "amount": 0.05,  
                        "currency": "usd",  
                        "grain": "hourly"  
                    },  
                    "links": {  
                        "product": {  
                            "uri": "/products/DZH318Z09V6F?country=US",  
                            "method": "GET",  
                            "headers": []  
                        },  
                        "sku": {  
                            "uri": "/products/DZH318Z09V6F/skus/0001?country=US",  
                            "method": "GET",  
                            "headers": []  
                        },  
                        "availability": {  
                            "uri": "/products/DZH318Z09V6F/skus/0001/availabilities/DZH318Z0BLD3?country=US",  
                            "method": "GET",  
                            "headers": []  
                        }  
                    }  
                }  
            ],  
            "creationDate": "2023-05-18T05:16:33.1368156Z",  
            "status": "pending",  
            "transactionType": "UserPurchase",  
            "links": {  
                "self": {  
                    "uri": "/customers/6f4ce4d8-f42e-45e0-8661-92ad6ac9d003/orders/2b912b339251",  
                    "method": "GET",  
                    "headers": []  
                },  
                "provisioningStatus": {  
                    "uri": "/customers/6f4ce4d8-f42e-45e0-8661-92ad6ac9d003/orders/2b912b339251/provisioningstatus",  
                    "method": "GET",  
                    "headers": []  
                },  
                "patchOperation": {  
                    "uri": "/customers/6f4ce4d8-f42e-45e0-8661-92ad6ac9d003/orders/2b912b339251",  
                    "method": "PATCH",  
                    "headers": []  
                }  
            },  
            "totalPrice": 438.0,  
            "client": {},  
            "attributes": {  
                "objectType": "Order"  
            }  
        }  
    ],  
    "additionalInformation": [],  
    "attributes": {  
        "objectType": "CartCheckoutResult"  
    }  
}

建立訂單

要求

{  
    "BillingCycle": "monthly",  
    "ReferenceCustomerId": "6f4ce4d8-f42e-45e0-8661-92ad6ac9d003",  
    "LineItems": [  
        {  
            "LineItemNumber": 0,  
            "OfferId": "DZH318Z09V6F:0001:DZH318Z0BLD3",  
            "Quantity": 1,  
            "TermDuration": "P1Y",  
            "ProvisioningContext": {  
                "scope": "single",  
                "entitlementId": "cdd17cc7-14fe-4445-8650-1f52de705851"  
            },  
            "PurchaseCommitment": {  
                "amount": 0.05,  
                "currency": "usd",  
                "grain": "hourly"  
            }  
        }  
    ]  
}

回應

{  
    "id": "2b912b3392fd",  
    "alternateId": "2b912b3392fd",  
    "referenceCustomerId": "6f4ce4d8-f42e-45e0-8661-92ad6ac9d003",  
    "billingCycle": "monthly",  
    "currencyCode": "USD",  
    "currencySymbol": "US$",  
    "lineItems": [  
        {  
            "lineItemNumber": 0,  
            "provisioningContext": {  
                "scope": "single",  
                "entitlementId": "cdd17cc7-14fe-4445-8650-1f52de705851"  
            },  
            "offerId": "DZH318Z09V6F:0001:DZH318Z0BLD3",  
            "termDuration": "P1Y",  
            "transactionType": "New",  
            "friendlyName": "Compute savings plan, 1 Year",  
            "quantity": 1,  
            "pricing": {  
                "listPrice": 438.0,  
                "discountedPrice": 438.0,  
                "proratedPrice": 438.0,  
                "price": 438.0,  
                "extendedPrice": 438.0  
            },  
            "purchaseCommitment": {  
                "amount": 0.05,  
                "currency": "usd",  
                "grain": "hourly"  
            },  
            "links": {  
                "product": {  
                    "uri": "/products/DZH318Z09V6F?country=US",  
                    "method": "GET",  
                    "headers": []  
                },  
                "sku": {  
                    "uri": "/products/DZH318Z09V6F/skus/0001?country=US",  
                    "method": "GET",  
                    "headers": []  
                },  
                "availability": {  
                    "uri": "/products/DZH318Z09V6F/skus/0001/availabilities/DZH318Z0BLD3?country=US",  
                    "method": "GET",  
                    "headers": []  
                }  
            }  
        }  
    ],  
    "creationDate": "2023-05-18TT21:22:26.7034834Z",  
    "status": "pending",  
    "transactionType": "UserPurchase",  
    "links": {  
        "self": {  
            "uri": "/customers/6f4ce4d8-f42e-45e0-8661-92ad6ac9d003/orders/2b912b3392fd",  
            "method": "GET",  
            "headers": []  
        },  
        "provisioningStatus": {  
            "uri": "/customers/6f4ce4d8-f42e-45e0-8661-92ad6ac9d003/orders/2b912b3392fd/provisioningstatus",  
            "method": "GET",  
            "headers": []  
        },  
        "patchOperation": {  
            "uri": "/customers/6f4ce4d8-f42e-45e0-8661-92ad6ac9d003/orders/2b912b3392fd",  
            "method": "PATCH",  
            "headers": []  
        }  
    },  
    "client": {},  
    "attributes": {  
        "objectType": "Order"  
    }  
}

訂單和訂用帳戶 API 範例

依照識別碼取得訂單

回應

{
    "id": "2b912b3392fd",
    "alternateId": "2b912b3392fd",
    "referenceCustomerId": "6f4ce4d8-f42e-45e0-8661-92ad6ac9d003",
    "billingCycle": "monthly",
    "currencyCode": "USD",
    "currencySymbol": "US$",
    "lineItems": [
        {
            "lineItemNumber": 0,
            "subscriptionId": "005a9b31-3ba0-4ead-b4fe-ad11e072f7e7",
            "provisioningContext": {
                "scope": "single",
                "entitlementId": "cdd17cc7-14fe-4445-8650-1f52de705851"
            },
            "offerId": "DZH318Z09V6F:0001:DZH318Z0BLD3",
            "termDuration": "P1Y",
            "transactionType": "New",
            "friendlyName": "Compute savings plan, 1 Year",
            "quantity": 1,
            "purchaseCommitment": {
                "amount": 0.05,
                "currency": "usd",
                "grain": "hourly"
            },
            "links": {
                "product": {
                    "uri": "/products/DZH318Z09V6F?country=US",
                    "method": "GET",
                    "headers": []
                },
                "sku": {
                    "uri": "/products/DZH318Z09V6F/skus/0001?country=US",
                    "method": "GET",
                    "headers": []
                },
                "availability": {
                    "uri": "/products/DZH318Z09V6F/skus/0001/availabilities/DZH318Z0BLD3?country=US",
                    "method": "GET",
                    "headers": []
                }
            }
        }
    ],
    "creationDate": "2023-05-18TT21:22:26.7034834Z",
    "status": "completed",
    "transactionType": "UserPurchase",
    "links": {
        "self": {
            "uri": "/customers/6f4ce4d8-f42e-45e0-8661-92ad6ac9d003/orders/2b912b3392fd",
            "method": "GET",
            "headers": []
        },
        "provisioningStatus": {
            "uri": "/customers/6f4ce4d8-f42e-45e0-8661-92ad6ac9d003/orders/2b912b3392fd/provisioningstatus",
            "method": "GET",
            "headers": []
        },
        "patchOperation": {
            "uri": "/customers/6f4ce4d8-f42e-45e0-8661-92ad6ac9d003/orders/2b912b3392fd",
            "method": "PATCH",
            "headers": []
        }
    },
    "client": {},
    "attributes": {
        "objectType": "Order"
    }
}

取得客戶的所有訂單

回應

{
    "totalCount": 1,
    "items": [
        {
            "id": "2b912b3392fd",
            "alternateId": "2b912b3392fd",
            "referenceCustomerId": "6f4ce4d8-f42e-45e0-8661-92ad6ac9d003",
            "billingCycle": "monthly",
            "currencyCode": "USD",
            "currencySymbol": "US$",
            "lineItems": [
                {
                    "lineItemNumber": 0,
                    "subscriptionId": "005a9b31-3ba0-4ead-b4fe-ad11e072f7e7",
                    "provisioningContext": {
                        "scope": "single",
                        "entitlementId": "cdd17cc7-14fe-4445-8650-1f52de705851"
                    },
                    "offerId": "DZH318Z09V6F:0001:DZH318Z0BLD3",
                    "termDuration": "P1Y",
                    "transactionType": "New",
                    "friendlyName": "Compute savings plan, 1 Year",
                    "quantity": 1,
                    "purchaseCommitment": {
                        "amount": 0.05,
                        "currency": "usd",
                        "grain": "hourly"
                    },
                    "links": {
                        "product": {
                            "uri": "/products/DZH318Z09V6F?country=US",
                            "method": "GET",
                            "headers": []
                        },
                        "sku": {
                            "uri": "/products/DZH318Z09V6F/skus/0001?country=US",
                            "method": "GET",
                            "headers": []
                        },
                        "availability": {
                            "uri": "/products/DZH318Z09V6F/skus/0001/availabilities/DZH318Z0BLD3?country=US",
                            "method": "GET",
                            "headers": []
                        }
                    }
                }
            ],
            "creationDate": "2023-05-18TT21:22:26.7034834Z",
            "status": "completed",
            "transactionType": "UserPurchase",
            "links": {
                "self": {
                    "uri": "/customers/6f4ce4d8-f42e-45e0-8661-92ad6ac9d003/orders/2b912b3392fd",
                    "method": "GET",
                    "headers": []
                },
                "provisioningStatus": {
                    "uri": "/customers/6f4ce4d8-f42e-45e0-8661-92ad6ac9d003/orders/2b912b3392fd/provisioningstatus",
                    "method": "GET",
                    "headers": []
                },
                "patchOperation": {
                    "uri": "/customers/6f4ce4d8-f42e-45e0-8661-92ad6ac9d003/orders/2b912b3392fd",
                    "method": "PATCH",
                    "headers": []
                }
            },
            "client": {},
            "attributes": {
                "objectType": "Order"
            }
        }
    ],
    "links": {
        "self": {
            "uri": "/customers/6f4ce4d8-f42e-45e0-8661-92ad6ac9d003/orders",
            "method": "GET",
            "headers": []
        }
    },
    "attributes": {
        "objectType": "Collection"
    }
}

依照識別碼取得訂用帳戶

回應

{
    "id": "a67afaf0-2f79-4c12-8fd1-6005ed24bb28",
    "offerId": "DZH318Z09V6F:0001:DZH318Z0BLD3",
    "offerName": "Compute savings plan, 1 Year",
    "friendlyName": "Compute_Savings_Plan_123",
    "productType": {
        "id": "Azure",
        "displayName": "Azure",
        "subType": {
            "id": "SavingsPlan",
            "displayName": "SavingsPlan"
        }
    },
    "quantity": 1,
    "unitType": "Benefit",
    "hasPurchasableAddons": false,
    "creationDate": "2023-05-18T05:19:22.5478955Z",
    "effectiveStartDate": "2023-05-18T05:19:21.3362111Z",
    "commitmentEndDate": "2024-05-17T00:00:00Z",
    "billingCycleEndDate": "2024-05-17T00:00:00Z",
     "status": "active",
    "autoRenewEnabled": true,
    "isTrial": false,
    "billingType": "benefit",
    "billingCycle": "one_time",
    "termDuration": "P1Y",
    "renewalTermDuration": "",
    "isMicrosoftProduct": true,
    "partnerId": "",
    "attentionNeeded": false,
    "actionTaken": false,
    "contractType": "subscription",
    "links": {
        "product": {
            "uri": "/products/DZH318Z09V6F?country=US",
            "method": "GET",
            "headers": []
        },
"sku": {
            "uri": "/products/DZH318Z09V6F/skus/0001?country=US",
            "method": "GET",
            "headers": []
        },
        "availability": {
            "uri": "/products/DZH318Z09V6F/skus/0001/availabilities/DZH318Z0BLD3?country=US",
            "method": "GET",
            "headers": []
        },
        "self": {
            "uri": "/customers/6f4ce4d8-f42e-45e0-8661-92ad6ac9d003/subscriptions/a67afaf0-2f79-4c12-8fd1-6005ed24bb28",
            "method": "GET",
            "headers": []
        }
    },
    "publisherName": "Microsoft Corporation",
    "lineItems": [
        {
            "id": "2131a68b-9796-4557-b628-354539ed66dc",
            "friendlyName": "Compute_Savings_Plan_123",
            "scope": {
                "type": "single",
                "entitlementId": "cdd17cc7-14fe-4445-8650-1f52de705851"
            },
            "autoRenewEnabled": true,
            "status": "active",
            "purchaseCommitment": {
                "amount": 0.05,
                "currency": "usd",
                "grain": "Hourly"
            }
        }
    ],
    "productOrderId": "2131a68b-9796-4557-b628-354539ed66dc",
    "orderId": "2b912b339251",
    "attributes": {
        "objectType": "Subscription"
    }
}

取得客戶的訂用帳戶

回應

{
    "totalCount": 1,
    "items": [
        {
            "id": "a67afaf0-2f79-4c12-8fd1-6005ed24bb28",
            "offerId": "DZH318Z09V6F:0001:DZH318Z0BLD3",
            "offerName": "Compute savings plan, 1 Year",
            "friendlyName": "Compute_Savings_Plan_123",
            "productType": {
                "id": "Azure",
                "displayName": "Azure",
                "subType": {
                    "id": "SavingsPlan",
                    "displayName": "SavingsPlan"
                }
            },
            "quantity": 1,
            "unitType": "Benefit",
            "hasPurchasableAddons": false,
            "creationDate": "2023-05-18T05:19:22.5478955Z",
            "effectiveStartDate": "2023-05-18T05:19:21.3362111Z",
            "commitmentEndDate": "2024-05-17T00:00:00Z",
            "commitmentEndDateTime": "2024-05-17T23:59:59Z",
            "billingCycleEndDate": "2024-05-17T00:00:00Z",
            "billingCycleEndDateTime": "2024-05-17T23:59:59Z",
            "status": "active",
            "autoRenewEnabled": true,
            "isTrial": false,
            "billingType": "benefit",
            "billingCycle": "one_time",
            "termDuration": "P1Y",
            "renewalTermDuration": "",
            "isMicrosoftProduct": true,
            "partnerId": "",
            "attentionNeeded": false,
            "actionTaken": false,
            "contractType": "subscription",
            "links": {
                "product": {
                    "uri": "/products/DZH318Z09V6F?country=US",
                    "method": "GET",
                    "headers": []
                },
                "sku": {
                    "uri": "/products/DZH318Z09V6F/skus/0001?country=US",
                    "method": "GET",
                    "headers": []
                },
                "availability": {
                    "uri": "/products/DZH318Z09V6F/skus/0001/availabilities/DZH318Z0BLD3?country=US",
                    "method": "GET",
                    "headers": []
                },
                "self": {
                    "uri": "/customers/6f4ce4d8-f42e-45e0-8661-92ad6ac9d003/subscriptions/a67afaf0-2f79-4c12-8fd1-6005ed24bb28",
                    "method": "GET",
                    "headers": []
                }
            },
            "publisherName": "Microsoft Corporation",
            "lineItems": [
                {
                    "id": "2131a68b-9796-4557-b628-354539ed66dc",
                    "friendlyName": "Compute_Savings_Plan_123",
                    "scope": {
                        "type": "single",
                        "entitlementId": "cdd17cc7-14fe-4445-8650-1f52de705851"
                    },
                    "autoRenewEnabled": true,
                    "status": "active",
                    "purchaseCommitment": {
                        "amount": 0.05,
                        "currency": "usd",
                        "grain": "Hourly"
                    }
                }
            ],
            "productOrderId": "2131a68b-9796-4557-b628-354539ed66dc",
            "orderId": "2b912b339251",
            "attributes": {
                "objectType": "Subscription"
            }
        }
    ],
    "links": {
        "self": {
            "uri": "/customers/6f4ce4d8-f42e-45e0-8661-92ad6ac9d003/subscriptions",
            "method": "GET",
            "headers": []
        }
    },
    "attributes": {
        "objectType": "Collection"
    }
}