获取合作伙伴的当前帐户余额
适用于:合作伙伴中心 | 由世纪互联运营的合作伙伴中心 | Microsoft Cloud for US Government 合作伙伴中心
检索合作伙伴的当前帐户余额。 定期费用和一次性费用发票余额和总费用的摘要。
必备条件
- 合作伙伴中心身份验证中所述的凭据。 此方案支持使用独立应用和应用+用户凭据进行身份验证。
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"
}
}