Create credit note
Credit all or part of an invoice with a refundable or adjustment credit note.
POST https://cotlet.dev/api/v1/chargebee/reference-invoices/{reference_invoice_id}/credit-notes
Creates a credit note on an invoice and returns it with the updated invoice. The invoice status decides the type: a paid invoice takes only refundable, a payment_due or not_paid invoice only adjustment, a partially paid one either. Pass total or line_items, not both; amounts are in the smallest currency unit, so 5000 is $50.00. A refundable credit note starts with refund due and moves no money until someone refunds it. The comment stays inside Chargebee; customer_notes print on the credit note PDF. This changes what a customer owes or is owed, so by default you confirm each call; you can switch that off for this tool.
Parameters
| Name | Type | Description |
|---|---|---|
| reference_invoice_id string required | string | Invoice to credit, from list_invoices. |
| type enum required | enum | refundable or adjustment, as the invoice status allows. |
| total integer | integer | Credit amount in the smallest currency unit. Use this or line_items. |
| line_items array | array | Invoice lines to credit, with an amount each. Use this or total. |
| reason_code string | string | A reason code configured in Chargebee, case-sensitive. Required if your site makes reason codes mandatory. |
| comment string | string | Internal note, 300 characters at most. Not shown to the customer. |
| customer_notes string | string | Text printed on the credit note PDF, 2000 characters at most. |
Request
curl -X POST https://cotlet.dev/api/v1/chargebee/reference-invoices/INV-1042/credit-notes \
-H "Authorization: Bearer $COTLET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"type":"refundable","total":5000,"comment":"Support ticket 4412"}' result = client.call("chargebee", "create_credit_note", {"reference_invoice_id":"INV-1042","type":"refundable","total":5000,"comment":"Support ticket 4412"}) const result = await cotlet.call('chargebee', 'create_credit_note', {"reference_invoice_id":"INV-1042","type":"refundable","total":5000,"comment":"Support ticket 4412"}); cotlet call chargebee create_credit_note --data '{"reference_invoice_id":"INV-1042","type":"refundable","total":5000,"comment":"Support ticket 4412"}' Example response
{
"credit_note": {
"credit_note_id": "CN-319",
"reference_invoice_id": "INV-1042",
"type": "refundable",
"status": "refund_due",
"total": 5000,
"currency_code": "USD",
"comment": "Support ticket 4412"
},
"invoice": {
"invoice_id": "INV-1042",
"status": "paid",
"total": 29900,
"amount_paid": 29900,
"amount_due": 0
}
}