This article covers
How do I get invoice details using Customer ID through API?
Summary
You can retrieve the details of the invoice using 'Retrieve Invoice API'.
Solution
To retrieve invoice details, the API call ideally used is the “Retrieve Invoice API”. However, we can only pass the invoice ID as the input parameter for this API call.
To be able to retrieve the invoice details using Customer ID or other values like subscription ID, invoice status, invoice date, type (recurring or not) dunning status, etc, we can make use of the List invoices API call.
Here is a sample API call -
curl https://{SITE-NAME}.chargebee.com/api/v2/invoices \
-G \
-u {API-KEY:\
--data-urlencode limit=5 \
--data-urlencode subscription_id[is]=”3bdjnDnsdQn”
--data-urlencode status[in]="["paid","payment_due"]" \
--data-urlencode sort_by[asc]="date"
Please refer to the list of input parameters that can be used in this API call with their definitions in the “FILTER PARAMS” section of our API call here.