取得合作夥伴的目前帳戶餘額
適用于:合作夥伴中心 |由 21Vianet 營運的合作夥伴中心 |適用于 Microsoft Cloud for US Government 的合作夥伴中心
擷取合作夥伴目前的帳戶餘額。 週期性費用和一次性費用之發票餘額和總費用的摘要。
必要條件
- 認證,如合作夥伴中心驗證所述。 此案例支援使用獨立應用程式和 App+使用者認證進行驗證。
C#
若要擷取您的帳戶餘額,請使用 IAggregatePartner.Invoices 集合,然後呼叫 Summary 屬性。 然後呼叫 Get 函式,最後呼叫 BalanceAmount 屬性。
// IAggregatePartner scopedPartnerOperations;
var invoiceSummary = scopedPartnerOperations.Invoices.Summary.Get();
Console.Out.WriteLine("Current Account Balance: {0:C}", invoiceSummary.BalanceAmount);
範例: 主控台測試應用程式。 專案:PartnerSDK.FeatureSample 類別:GetInvoiceSummary.cs
REST 要求
要求的語法
方法 | 要求 URI |
---|---|
GET | {baseURL}/v1/invoices/summary HTTP/1.1 |
要求標頭
如需詳細資訊,請參閱合作夥伴中心 REST 標頭。
要求本文
無
要求範例
GET https://api.partnercenter.microsoft.com/v1/invoices/summary 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 回應
如果成功,這個方法會在回應中傳回 InvoiceSummary 資源。
回應成功和錯誤碼
每個回應都隨附 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
{
"balanceAmount": 751094.39,
"currencyCode": "USD",
"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": "USD",
"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": "USD",
"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"
}
}