共用方式為


按 ID 獲取發票

適用於:21Vianet 營運的合作夥伴中心 |適用於美國政府的 Microsoft 雲端合作夥伴中心

備註

對於現代商業購買,此 API 僅適用於 2025 年 5 月 15 日之前產生的發票。

使用發票 ID 擷取指定的發票。

先決條件

C#

若要依身分證件取得月結單:

  1. 使用您的 IPartner.Invoices 集合並呼叫 ById() 方法。

  2. 呼叫 Get()GetAsync() 方法。

// IPartner scopedPartnerOperations;
// string selectedInvoiceId;

var invoice = scopedPartnerOperations.Invoices.ById(selectedInvoiceId).Get();

範例控制台測試應用程式專案:PartnerSDK.Feature範例 類別:GetInvoice.cs

REST 要求

請求語法

方法 請求網址識別碼 (URI)
GET {baseURL}/v1/invoices/{invoice-id} HTTP/1.1

URI 參數

使用下列查詢參數來取得發票。

名稱 類型 為必填項目 Description
發票 ID 字串 Yes 值是 發票識別碼 ,可讓經銷商篩選指定發票的結果。

請求標頭

如需詳細資訊,請參閱合作夥伴中心 REST 標頭

請求主體

None

範例請求

GET https://api.partnercenter.microsoft.com/v1/invoices/<invoice-id> HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 8ac25aa5-9537-4b6d-b782-aa0c8e979e99
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd

REST 響應

如果成功,這個方法會在回應內文中傳回 Invoice 資源。

回應成功和錯誤碼

每個回應都有一個 HTTP 狀態代碼,指出成功或失敗和其他偵錯資訊。 請使用網路追蹤工具來讀取此錯誤碼、錯誤類型和其他參數。 如需完整清單,請參閱錯誤碼

回應範例

HTTP/1.1 200 OK
Content-Length: 676
Content-Type: application/json; charset=utf-8
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
MS-RequestId: 8ac25aa5-9537-4b6d-b782-aa0c8e979e99
Date: Thu, 24 Mar 2016 05:22:14 GMT

{
    "id": "G000024135",
    "invoiceDate": "2018-02-08T22:40:37.5897767Z",
    "billingPeriodStartDate": "2018-02-01T22:40:37.5897767Z",
    "billingPeriodEndDate": "2018-02-28T22:40:37.5897767Z",
    "totalCharges": 2076.63,
    "paidAmount": 0,
    "currencyCode": "USD",
    "currencySymbol": "$",
    "pdfDownloadLink": "/invoices/G000024135/documents/statement",
    "taxReceipts": [
        {
            "id": "123456",
            "taxReceiptPdfDownloadLink": "/invoices/G000024135/receipts/123456/documents/statement"
        }
    ],
    "invoiceDetails": [
        {
            "invoiceLineItemType": "billing_line_items",
            "billingProvider": "one_time",
            "links": {
                "self": {
                    "uri": "/invoices/OneTime-G000024135/lineitems/OneTime/BillingLineItems",
                    "method": "GET",
                    "headers": []
                }
            },
            "attributes": {
                "objectType": "InvoiceDetail"
            }
        }
    ],
    "documentType": "invoice",
    "invoiceType": "OneTime",
    "links": {
        "self": {
            "uri": "/invoices/OneTime-G000024135",
            "method": "GET",
            "headers": []
        }
    },
    "attributes": {
        "objectType": "Invoice"
    }
}