Introducing the Chargebee CLI

How to retrieve invoices using customer ID or subscription ID?

This article covers

How do I get invoice details using a customer ID through the API?

Summary

You can retrieve an invoice with the Retrieve an invoice API.

Solution

To retrieve one invoice, use the Retrieve an invoice API. This call accepts only the invoice ID.

To retrieve invoices by customer ID, subscription ID, invoice status, invoice date, type (recurring or not), or dunning status, use the List invoices API.

Here is a sample API call:

 
 -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"

See the input parameters and their definitions in the FILTER PARAMS section of List invoices.