Sample - Stripe API
POST/v1/credit_notes/{id}

Update a credit note

Updates an existing credit note's editable fields. Supply memo to change the customer-facing text or metadata to attach structured key-value pairs, and use expand to request expanded response fields. Fields not supplied remain unchanged.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.
  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

1 parameter · 3 body fields
idstringrequired
The unique identifier of the credit note to update; maximum 5,000 characters.

Optional form-encoded fields for changing a credit note and selecting expanded response fields.

expandarray<string>optional
Specifies which fields in the response should be expanded.
memostringoptional
Credit note memo.
metadataobjectoptional
Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.

2 status codes
200Returns the updated credit note object, including its amounts, currency, customer, invoice, line items, memo, and metadata.
amountintegerrequired
The integer amount in cents (or local equivalent) representing the total amount of the credit note, including tax.
amount_shippingintegerrequired
This is the sum of all the shipping amounts.
createdintegerrequired
Time at which the object was created. Measured in seconds since the Unix epoch.
currencystringrequired
Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
customerstringrequired
ID of the customer.
customer_accountstringoptional
ID of the account representing the customer.
customer_balance_transactionstringoptional
Customer balance transaction related to this credit note.
discount_amountintegerrequired
The integer amount in cents (or local equivalent) representing the total amount of discount that was credited.
discount_amountsarray<DiscountsResourceDiscountAmount>required
The aggregate amounts calculated per discount for all line items.
effective_atintegeroptional
The date when this credit note is in effect. Same as `created` unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the credit note PDF.
idstringrequired
Unique identifier for the object.
invoicestringrequired
ID of the invoice.
linesobjectrequired
Line items that make up the credit note
livemodebooleanrequired
If the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`.
memostringoptional
Customer-facing text that appears on the credit note PDF.
metadataobjectoptional
Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
numberstringrequired
A unique number that identifies this particular credit note and appears on the PDF of the credit note and its associated invoice.
objectstringrequired
String representing the object's type. Objects of the same type share the same value.
Allowed:credit_note
out_of_band_amountintegeroptional
Amount that was credited outside of Stripe.
pdfstringrequired
The link to download the PDF of the credit note.
post_payment_amountintegerrequired
The amount of the credit note that was refunded to the customer, credited to the customer's balance, credited outside of Stripe, or any combination thereof.
pre_payment_amountintegerrequired
The amount of the credit note by which the invoice's `amount_remaining` and `amount_due` were reduced.
pretax_credit_amountsarray<CreditNotesPretaxCreditAmount>required
The pretax credit amounts (ex: discount, credit grants, etc) for all line items.
reasonstringoptional
Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory`
Allowed:duplicatefraudulentorder_changeproduct_unsatisfactory
refundsarray<CreditNoteRefund>required
Refunds related to this credit note.
shipping_costobjectoptional
The details of the cost of shipping, including the ShippingRate applied to the invoice.
statusstringrequired
Status of this credit note, one of `issued` or `void`. Learn more about [voiding credit notes](https://docs.stripe.com/billing/invoices/credit-notes#voiding).
Allowed:issuedvoid
subtotalintegerrequired
The integer amount in cents (or local equivalent) representing the amount of the credit note, excluding exclusive tax and invoice level discounts.
subtotal_excluding_taxintegeroptional
The integer amount in cents (or local equivalent) representing the amount of the credit note, excluding all tax and invoice level discounts.
totalintegerrequired
The integer amount in cents (or local equivalent) representing the total amount of the credit note, including tax and all discount.
total_excluding_taxintegeroptional
The integer amount in cents (or local equivalent) representing the total amount of the credit note, excluding tax, but including discounts.
total_taxesarray<BillingBillResourceInvoicingTaxesTax>optional
The aggregate tax information for all line items.
typestringrequired
Type of this credit note, one of `pre_payment` or `post_payment`. A `pre_payment` credit note means it was issued when the invoice was open. A `post_payment` credit note means it was issued when the invoice was paid.
Allowed:mixedpost_paymentpre_payment
voided_atintegeroptional
The time that the credit note was voided.
defaultError response.
errorobjectrequired

Error handling

id must identify the credit note to update and may contain at most 5,000 characters. memo must not exceed 5,000 characters, and metadata values must be strings; post an empty value to unset an individual metadata key.