取得發票摘要
適用于:合作夥伴中心 |由 21Vianet 營運的合作夥伴中心 |適用于 Microsoft Cloud for US Government 的合作夥伴中心
您可以使用 InvoiceSummaries 來擷取發票摘要,其中顯示週期性費用和一次性費用的餘額和總費用。 InvoiceSummaries資源包含每個貨幣類型的發票摘要。
必要條件
認證,如合作夥伴中心驗證所述。 此案例僅支援使用「應用程式+使用者」認證來進行驗證。
有效的發票識別碼。
C#
若要擷取包含每個貨幣類型的InvoiceSummary 的InvoiceSummaries集合:
使用 IAggregatePartner.Invoices 集合來呼叫 Summaries 屬性。
呼叫 Get () 方法。
若要取得個別 InvoiceSummary的餘額,請存取該集合成員的 BalanceAmount 屬性。
// IAggregatePartner scopedPartnerOperations;
// Get the invoice summaries collection.
var invoiceSummaries = scopedPartnerOperations.Invoices.Summaries.Get();
// Display the balance on the first invoice summary in the collection.
Console.Out.WriteLine("Current Account Balance: {0:C}", invoiceSummaries[0].BalanceAmount);
如需詳細資訊,請參閱下列範例程式碼:
- 範例: 主控台測試應用程式
- 專案: PartnerSDK.FeatureSample
- 類別: GetInvoiceSummaries.cs
REST 要求
要求的語法
方法 | 要求 URI |
---|---|
GET | {baseURL}/v1/invoices/summaries HTTP/1.1 |
URI 參數
無。
要求標頭
如需詳細資訊,請參閱合作夥伴中心 REST 標頭。
要求本文
無。
要求範例
GET https://api.partnercenter.microsoft.com/v1/invoices/summaries HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: a45e6643-1caf-4429-8f90-07c03d85bc2b
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
Connection: Keep-Alive
REST 回應
如果成功,這個方法會在回應本文中傳回 InvoiceSummaries 資源。
回應成功和錯誤碼
每個回應都隨附 HTTP 狀態碼,會指出成功與否以及其他的偵錯資訊。 請使用網路追蹤工具來讀取此錯誤碼、錯誤類型和其他參數。 如需完整清單,請參閱錯誤碼。
回應範例
HTTP/1.1 200 OK
Content-Length: 256
Content-Type: application/json; charset=utf-8
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
MS-RequestId: a45e6643-1caf-4429-8f90-07c03d85bc2b
Date: Thu, 24 Mar 2016 05:21:01 GMT
{
"totalCount": 3,
"items": [
{
"balanceAmount": 751094.39,
"currencyCode": "GBP",
"currencySymbol": "£",
"accountingDate": "2018-03-16T00:00:00",
"firstInvoiceCreationDate": "2017-01-21T00:00:00Z",
"lastPaymentDate": "2017-01-01T12:00:00Z",
"lastPaymentAmount": 1000,
"latestInvoiceDate": "2018-03-16T00:00:00",
"details": [
{
"invoiceType": "Recurring",
"summary": {
"balanceAmount": 202955.87,
"currencyCode": "GBP",
"currencySymbol": "£",
"accountingDate": "2017-02-27T00:00:00Z",
"firstInvoiceCreationDate": "2017-01-21T00:00:00Z",
"lastPaymentDate": "2017-01-01T12:00:00Z",
"lastPaymentAmount": 1000,
"latestInvoiceDate": "0001-01-01T00:00:00",
"attributes": {
"objectType": "InvoiceSummary"
}
}
},
{
"invoiceType": "OneTime",
"summary": {
"balanceAmount": 548138.52,
"currencyCode": "GBP",
"currencySymbol": "£",
"accountingDate": "2018-03-16T00:00:00",
"firstInvoiceCreationDate": "2018-03-16T00:00:00",
"lastPaymentDate": "0001-01-01T00:00:00",
"lastPaymentAmount": 0,
"latestInvoiceDate": "2018-03-16T00:00:00",
"attributes": {
"objectType": "InvoiceSummary"
}
}
}
],
"links": {
"self": {
"uri": "/invoices/summary",
"method": "GET",
"headers": []
}
},
"attributes": {
"objectType": "InvoiceSummary"
}
},
{
"balanceAmount": 1230.33,
"currencyCode": "CHF",
"currencySymbol": "CHF",
"accountingDate": "2018-03-16T00:00:00",
"firstInvoiceCreationDate": "2018-03-16T00:00:00",
"lastPaymentDate": "0001-01-01T00:00:00",
"lastPaymentAmount": 0,
"latestInvoiceDate": "2018-03-16T00:00:00",
"details": [
{
"invoiceType": "OneTime",
"summary": {
"balanceAmount": 1230.33,
"currencyCode": "CHF",
"currencySymbol": "CHF",
"accountingDate": "2018-03-16T00:00:00",
"firstInvoiceCreationDate": "2018-03-16T00:00:00",
"lastPaymentDate": "0001-01-01T00:00:00",
"lastPaymentAmount": 0,
"latestInvoiceDate": "2018-03-16T00:00:00",
"attributes": {
"objectType": "InvoiceSummary"
}
}
}
],
"links": {
"self": {
"uri": "/invoices/summary",
"method": "GET",
"headers": []
}
},
"attributes": {
"objectType": "InvoiceSummary"
}
},
{
"balanceAmount": 1001.12,
"currencyCode": "EUR",
"currencySymbol": "€",
"accountingDate": "2018-03-16T00:00:00",
"firstInvoiceCreationDate": "2018-03-16T00:00:00",
"lastPaymentDate": "0001-01-01T00:00:00",
"lastPaymentAmount": 0,
"latestInvoiceDate": "2018-03-16T00:00:00",
"details": [
{
"invoiceType": "OneTime",
"summary": {
"balanceAmount": 1001.12,
"currencyCode": "EUR",
"currencySymbol": "€",
"accountingDate": "2018-03-16T00:00:00",
"firstInvoiceCreationDate": "2018-03-16T00:00:00",
"lastPaymentDate": "0001-01-01T00:00:00",
"lastPaymentAmount": 0,
"latestInvoiceDate": "2018-03-16T00:00:00",
"attributes": {
"objectType": "InvoiceSummary"
}
}
}
],
"links": {
"self": {
"uri": "/invoices/summary",
"method": "GET",
"headers": []
}
},
"attributes": {
"objectType": "InvoiceSummary"
}
}
],
"links": {
"self": {
"uri": "/invoices/summaries",
"method": "GET",
"headers": []
}
},
"attributes": {
"objectType": "Collection"
}
}