Apply credits for an invoice
Open in PostmanApplies a customer's refundable credits to a specified invoice.
You can specify the credit notes to apply, including the amount to apply from each credit note and the time it is applied. If you omit the credit notes, Chargebee applies the available credit notes automatically.
Prerequisites & Constraints
- The customer must have refundable credits available.
- The invoice
statusmust benot_paid,payment_due, orposted.
Impacts
Invoice
- The
amount_duedecreases by the amount of credits applied. - The invoice
status:- changes to
paidif the applied credits fully cover the amount due. - remains unchanged if the applied credits only partially cover the amount due.
- changes to
- When the invoice becomes
paid,paid_atis set to thecredit_notes[applied_at]of the application that broughtamount_dueto zero. If that parameter is omitted,paid_atis the current time.
Credit Notes
The credit note status:
- changes to
refundedif the entirecredit_note.amount_availableis applied to the invoice. - remains
refund_dueif only part of thecredit_note.amount_availableis applied.
Implementation Notes
Before calling this API, make sure the following conditions are met:
customer.refundable_creditsis non-zero.- The invoice
statusisnot_paid,payment_due, orposted. - The
credit_note.customer_idmatches theinvoice.customer_id.
Sample Request
Sample Result[JSON]
URL Format
POST https://[site].chargebee.com/api/v2/invoices/{invoice-id}/apply_credits
Input Parameters
An internal comment to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing Hosted Page or any document such as the Invoice PDF .
Returns
Invoice object
Resource object representing invoice