Get invoice by ID
Article 07/10/2024
5 contributors
Feedback
In this article
Prerequisites
C#
REST request
REST response
Applies to : Partner Center | Partner Center operated by 21Vianet | Partner Center for Microsoft Cloud for US Government
Retrieves a given invoice using the invoice ID.
To get an invoice by ID:
Use your IPartner.Invoices collection and call the ById() method.
Call the Get() or GetAsync() methods.
var invoice = scopedPartnerOperations.Invoices.ById(selectedInvoiceId).Get();
Sample : Console test app . Project : PartnerSDK.FeatureSample Class : GetInvoice.cs
Expand table
Method
Request URI
GET
{baseURL} /v1/invoices/{invoice-id} HTTP/1.1
Use the following query parameter to get the invoice.
Expand table
Name
Type
Required
Description
invoice-id
string
Yes
The value is an invoice-id that allows the reseller to filter the results for a given invoice.
For more information, see Partner Center REST headers .
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
If successful, this method returns an Invoice resource in the response body.
Response success and error codes
Each response comes with an HTTP status code that indicates success or failure and additional debugging information. Use a network trace tool to read this code, error type, and additional parameters. For the full list, see Error Codes .
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 -08 T22 :40 :37 .5897767 Z",
"billingPeriodStartDate ": "2018 -02 -01 T22 :40 :37 .5897767 Z",
"billingPeriodEndDate ": "2018 -02 -28 T22 :40 :37 .5897767 Z",
"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 "
}
}