Class CreditNote

All Implemented Interfaces:
HasId, MetadataStore<CreditNote>, StripeActiveObject, StripeObjectInterface

public class CreditNote extends ApiResource implements HasId, MetadataStore<CreditNote>
Issue a credit note to adjust an invoice's amount after the invoice is finalized.

Related guide: Credit notes

  • Constructor Details

    • CreditNote

      public CreditNote()
  • Method Details

    • getCustomer

      public String getCustomer()
      Get ID of expandable customer object.
    • setCustomer

      public void setCustomer(String id)
    • getCustomerObject

      public Customer getCustomerObject()
      Get expanded customer.
    • setCustomerObject

      public void setCustomerObject(Customer expandableObject)
    • getCustomerBalanceTransaction

      public String getCustomerBalanceTransaction()
      Get ID of expandable customerBalanceTransaction object.
    • setCustomerBalanceTransaction

      public void setCustomerBalanceTransaction(String id)
    • getCustomerBalanceTransactionObject

      public CustomerBalanceTransaction getCustomerBalanceTransactionObject()
      Get expanded customerBalanceTransaction.
    • setCustomerBalanceTransactionObject

      public void setCustomerBalanceTransactionObject(CustomerBalanceTransaction expandableObject)
    • getInvoice

      public String getInvoice()
      Get ID of expandable invoice object.
    • setInvoice

      public void setInvoice(String id)
    • getInvoiceObject

      public Invoice getInvoiceObject()
      Get expanded invoice.
    • setInvoiceObject

      public void setInvoiceObject(Invoice expandableObject)
    • create

      public static CreditNote create(Map<String,Object> params) throws StripeException
      Issue a credit note to adjust the amount of a finalized invoice. A credit note will first reduce the invoice’s amount_remaining (and amount_due), but not below zero. This amount is indicated by the credit note’s pre_payment_amount. The excess amount is indicated by post_payment_amount, and it can result in any combination of the following:

      • Refunds: create a new refund (using refund_amount) or link existing refunds (using refunds).
      • Customer balance credit: credit the customer’s balance (using credit_amount) which will be automatically applied to their next invoice when it’s finalized.
      • Outside of Stripe credit: record the amount that is or will be credited outside of Stripe (using out_of_band_amount).

      The sum of refunds, customer balance credits, and outside of Stripe credits must equal the post_payment_amount.

      You may issue multiple credit notes for an invoice. Each credit note may increment the invoice’s pre_payment_credit_notes_amount, post_payment_credit_notes_amount, or both, depending on the invoice’s amount_remaining at the time of credit note creation.

      For invoices that also have refunds created through the Refund API, the credit note API subtracts those refund amounts from the maximum creditable amount. This prevents the combined credit notes and refunds from exceeding the invoice amount. If you use both, ensure the combined total does not exceed the invoice’s paid amount.

      Throws:
      StripeException
    • create

      public static CreditNote create(Map<String,Object> params, RequestOptions options) throws StripeException
      Issue a credit note to adjust the amount of a finalized invoice. A credit note will first reduce the invoice’s amount_remaining (and amount_due), but not below zero. This amount is indicated by the credit note’s pre_payment_amount. The excess amount is indicated by post_payment_amount, and it can result in any combination of the following:

      • Refunds: create a new refund (using refund_amount) or link existing refunds (using refunds).
      • Customer balance credit: credit the customer’s balance (using credit_amount) which will be automatically applied to their next invoice when it’s finalized.
      • Outside of Stripe credit: record the amount that is or will be credited outside of Stripe (using out_of_band_amount).

      The sum of refunds, customer balance credits, and outside of Stripe credits must equal the post_payment_amount.

      You may issue multiple credit notes for an invoice. Each credit note may increment the invoice’s pre_payment_credit_notes_amount, post_payment_credit_notes_amount, or both, depending on the invoice’s amount_remaining at the time of credit note creation.

      For invoices that also have refunds created through the Refund API, the credit note API subtracts those refund amounts from the maximum creditable amount. This prevents the combined credit notes and refunds from exceeding the invoice amount. If you use both, ensure the combined total does not exceed the invoice’s paid amount.

      Throws:
      StripeException
    • create

      public static CreditNote create(CreditNoteCreateParams params) throws StripeException
      Issue a credit note to adjust the amount of a finalized invoice. A credit note will first reduce the invoice’s amount_remaining (and amount_due), but not below zero. This amount is indicated by the credit note’s pre_payment_amount. The excess amount is indicated by post_payment_amount, and it can result in any combination of the following:

      • Refunds: create a new refund (using refund_amount) or link existing refunds (using refunds).
      • Customer balance credit: credit the customer’s balance (using credit_amount) which will be automatically applied to their next invoice when it’s finalized.
      • Outside of Stripe credit: record the amount that is or will be credited outside of Stripe (using out_of_band_amount).

      The sum of refunds, customer balance credits, and outside of Stripe credits must equal the post_payment_amount.

      You may issue multiple credit notes for an invoice. Each credit note may increment the invoice’s pre_payment_credit_notes_amount, post_payment_credit_notes_amount, or both, depending on the invoice’s amount_remaining at the time of credit note creation.

      For invoices that also have refunds created through the Refund API, the credit note API subtracts those refund amounts from the maximum creditable amount. This prevents the combined credit notes and refunds from exceeding the invoice amount. If you use both, ensure the combined total does not exceed the invoice’s paid amount.

      Throws:
      StripeException
    • create

      public static CreditNote create(CreditNoteCreateParams params, RequestOptions options) throws StripeException
      Issue a credit note to adjust the amount of a finalized invoice. A credit note will first reduce the invoice’s amount_remaining (and amount_due), but not below zero. This amount is indicated by the credit note’s pre_payment_amount. The excess amount is indicated by post_payment_amount, and it can result in any combination of the following:

      • Refunds: create a new refund (using refund_amount) or link existing refunds (using refunds).
      • Customer balance credit: credit the customer’s balance (using credit_amount) which will be automatically applied to their next invoice when it’s finalized.
      • Outside of Stripe credit: record the amount that is or will be credited outside of Stripe (using out_of_band_amount).

      The sum of refunds, customer balance credits, and outside of Stripe credits must equal the post_payment_amount.

      You may issue multiple credit notes for an invoice. Each credit note may increment the invoice’s pre_payment_credit_notes_amount, post_payment_credit_notes_amount, or both, depending on the invoice’s amount_remaining at the time of credit note creation.

      For invoices that also have refunds created through the Refund API, the credit note API subtracts those refund amounts from the maximum creditable amount. This prevents the combined credit notes and refunds from exceeding the invoice amount. If you use both, ensure the combined total does not exceed the invoice’s paid amount.

      Throws:
      StripeException
    • list

      public static CreditNoteCollection list(Map<String,Object> params) throws StripeException
      Returns a list of credit notes.
      Throws:
      StripeException
    • list

      public static CreditNoteCollection list(Map<String,Object> params, RequestOptions options) throws StripeException
      Returns a list of credit notes.
      Throws:
      StripeException
    • list

      public static CreditNoteCollection list(CreditNoteListParams params) throws StripeException
      Returns a list of credit notes.
      Throws:
      StripeException
    • list

      public static CreditNoteCollection list(CreditNoteListParams params, RequestOptions options) throws StripeException
      Returns a list of credit notes.
      Throws:
      StripeException
    • preview

      public static CreditNote preview(Map<String,Object> params) throws StripeException
      Get a preview of a credit note without creating it.
      Throws:
      StripeException
    • preview

      public static CreditNote preview(Map<String,Object> params, RequestOptions options) throws StripeException
      Get a preview of a credit note without creating it.
      Throws:
      StripeException
    • preview

      public static CreditNote preview(CreditNotePreviewParams params) throws StripeException
      Get a preview of a credit note without creating it.
      Throws:
      StripeException
    • preview

      public static CreditNote preview(CreditNotePreviewParams params, RequestOptions options) throws StripeException
      Get a preview of a credit note without creating it.
      Throws:
      StripeException
    • retrieve

      public static CreditNote retrieve(String id) throws StripeException
      Retrieves the credit note object with the given identifier.
      Throws:
      StripeException
    • retrieve

      public static CreditNote retrieve(String id, RequestOptions options) throws StripeException
      Retrieves the credit note object with the given identifier.
      Throws:
      StripeException
    • retrieve

      public static CreditNote retrieve(String id, Map<String,Object> params, RequestOptions options) throws StripeException
      Retrieves the credit note object with the given identifier.
      Throws:
      StripeException
    • retrieve

      public static CreditNote retrieve(String id, CreditNoteRetrieveParams params, RequestOptions options) throws StripeException
      Retrieves the credit note object with the given identifier.
      Throws:
      StripeException
    • update

      public CreditNote update(Map<String,Object> params) throws StripeException
      Updates an existing credit note.
      Specified by:
      update in interface MetadataStore<CreditNote>
      Throws:
      StripeException
    • update

      public CreditNote update(Map<String,Object> params, RequestOptions options) throws StripeException
      Updates an existing credit note.
      Specified by:
      update in interface MetadataStore<CreditNote>
      Throws:
      StripeException
    • update

      public CreditNote update(CreditNoteUpdateParams params) throws StripeException
      Updates an existing credit note.
      Throws:
      StripeException
    • update

      public CreditNote update(CreditNoteUpdateParams params, RequestOptions options) throws StripeException
      Updates an existing credit note.
      Throws:
      StripeException
    • voidCreditNote

      public CreditNote voidCreditNote() throws StripeException
      Marks a credit note as void. Learn more about voiding credit notes.
      Throws:
      StripeException
    • voidCreditNote

      public CreditNote voidCreditNote(RequestOptions options) throws StripeException
      Marks a credit note as void. Learn more about voiding credit notes.
      Throws:
      StripeException
    • voidCreditNote

      public CreditNote voidCreditNote(Map<String,Object> params) throws StripeException
      Marks a credit note as void. Learn more about voiding credit notes.
      Throws:
      StripeException
    • voidCreditNote

      public CreditNote voidCreditNote(Map<String,Object> params, RequestOptions options) throws StripeException
      Marks a credit note as void. Learn more about voiding credit notes.
      Throws:
      StripeException
    • voidCreditNote

      public CreditNote voidCreditNote(CreditNoteVoidCreditNoteParams params) throws StripeException
      Marks a credit note as void. Learn more about voiding credit notes.
      Throws:
      StripeException
    • voidCreditNote

      public CreditNote voidCreditNote(CreditNoteVoidCreditNoteParams params, RequestOptions options) throws StripeException
      Marks a credit note as void. Learn more about voiding credit notes.
      Throws:
      StripeException
    • setResponseGetter

      public void setResponseGetter(StripeResponseGetter responseGetter)
      Get expanded taxRate.
      Specified by:
      setResponseGetter in interface StripeActiveObject
      Overrides:
      setResponseGetter in class ApiResource
      Parameters:
      responseGetter - the StripeResponseGetter instance to use for making further requests.
    • getAmount

      public Long getAmount()
      The integer amount in cents (or local equivalent) representing the total amount of the credit note, including tax.
    • getAmountShipping

      public Long getAmountShipping()
      This is the sum of all the shipping amounts.
    • getCreated

      public Long getCreated()
      Time at which the object was created. Measured in seconds since the Unix epoch.
    • getCurrency

      public String getCurrency()
      Three-letter ISO currency code, in lowercase. Must be a supported currency.
    • getCustomerAccount

      public String getCustomerAccount()
      ID of the account representing the customer.
    • getDiscountAmount

      public Long getDiscountAmount()
      The integer amount in cents (or local equivalent) representing the total amount of discount that was credited.
    • getDiscountAmounts

      public List<CreditNote.DiscountAmount> getDiscountAmounts()
      The aggregate amounts calculated per discount for all line items.
    • getEffectiveAt

      public Long getEffectiveAt()
      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.
    • getLines

      public CreditNoteLineItemCollection getLines()
      Line items that make up the credit note.
    • getLivemode

      public Boolean getLivemode()
      If the object exists in live mode, the value is true. If the object exists in test mode, the value is false.
    • getMemo

      public String getMemo()
      Customer-facing text that appears on the credit note PDF.
    • getNumber

      public String getNumber()
      A unique number that identifies this particular credit note and appears on the PDF of the credit note and its associated invoice.
    • getObject

      public String getObject()
      String representing the object's type. Objects of the same type share the same value.

      Equal to credit_note.

    • getOutOfBandAmount

      public Long getOutOfBandAmount()
      Amount that was credited outside of Stripe.
    • getPdf

      public String getPdf()
      The link to download the PDF of the credit note.
    • getPostPaymentAmount

      public Long getPostPaymentAmount()
      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.
    • getPrePaymentAmount

      public Long getPrePaymentAmount()
      The amount of the credit note by which the invoice's amount_remaining and amount_due were reduced.
    • getPretaxCreditAmounts

      public List<CreditNote.PretaxCreditAmount> getPretaxCreditAmounts()
      The pretax credit amounts (ex: discount, credit grants, etc) for all line items.
    • getReason

      public String getReason()
      Reason for issuing this credit note, one of duplicate, fraudulent, order_change, or product_unsatisfactory.
    • getRefunds

      public List<CreditNote.Refund> getRefunds()
      Refunds related to this credit note.
    • getShippingCost

      public CreditNote.ShippingCost getShippingCost()
      The details of the cost of shipping, including the ShippingRate applied to the invoice.
    • getStatus

      public String getStatus()
      Status of this credit note, one of issued or void. Learn more about voiding credit notes.
    • getSubtotal

      public Long getSubtotal()
      The integer amount in cents (or local equivalent) representing the amount of the credit note, excluding exclusive tax and invoice level discounts.
    • getSubtotalExcludingTax

      public Long getSubtotalExcludingTax()
      The integer amount in cents (or local equivalent) representing the amount of the credit note, excluding all tax and invoice level discounts.
    • getTotal

      public Long getTotal()
      The integer amount in cents (or local equivalent) representing the total amount of the credit note, including tax and all discount.
    • getTotalExcludingTax

      public Long getTotalExcludingTax()
      The integer amount in cents (or local equivalent) representing the total amount of the credit note, excluding tax, but including discounts.
    • getTotalTaxes

      public List<CreditNote.TotalTax> getTotalTaxes()
      The aggregate tax information for all line items.
    • getType

      public String getType()
      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.
    • getVoidedAt

      public Long getVoidedAt()
      The time that the credit note was voided.
    • setAmount

      public void setAmount(Long amount)
      The integer amount in cents (or local equivalent) representing the total amount of the credit note, including tax.
    • setAmountShipping

      public void setAmountShipping(Long amountShipping)
      This is the sum of all the shipping amounts.
    • setCreated

      public void setCreated(Long created)
      Time at which the object was created. Measured in seconds since the Unix epoch.
    • setCurrency

      public void setCurrency(String currency)
      Three-letter ISO currency code, in lowercase. Must be a supported currency.
    • setCustomerAccount

      public void setCustomerAccount(String customerAccount)
      ID of the account representing the customer.
    • setDiscountAmount

      public void setDiscountAmount(Long discountAmount)
      The integer amount in cents (or local equivalent) representing the total amount of discount that was credited.
    • setDiscountAmounts

      public void setDiscountAmounts(List<CreditNote.DiscountAmount> discountAmounts)
      The aggregate amounts calculated per discount for all line items.
    • setEffectiveAt

      public void setEffectiveAt(Long effectiveAt)
      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.
    • setId

      public void setId(String id)
      Unique identifier for the object.
    • setLines

      public void setLines(CreditNoteLineItemCollection lines)
      Line items that make up the credit note.
    • setLivemode

      public void setLivemode(Boolean livemode)
      If the object exists in live mode, the value is true. If the object exists in test mode, the value is false.
    • setMemo

      public void setMemo(String memo)
      Customer-facing text that appears on the credit note PDF.
    • setMetadata

      public void setMetadata(Map<String,String> metadata)
      Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
    • setNumber

      public void setNumber(String number)
      A unique number that identifies this particular credit note and appears on the PDF of the credit note and its associated invoice.
    • setObject

      public void setObject(String object)
      String representing the object's type. Objects of the same type share the same value.

      Equal to credit_note.

    • setOutOfBandAmount

      public void setOutOfBandAmount(Long outOfBandAmount)
      Amount that was credited outside of Stripe.
    • setPdf

      public void setPdf(String pdf)
      The link to download the PDF of the credit note.
    • setPostPaymentAmount

      public void setPostPaymentAmount(Long postPaymentAmount)
      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.
    • setPrePaymentAmount

      public void setPrePaymentAmount(Long prePaymentAmount)
      The amount of the credit note by which the invoice's amount_remaining and amount_due were reduced.
    • setPretaxCreditAmounts

      public void setPretaxCreditAmounts(List<CreditNote.PretaxCreditAmount> pretaxCreditAmounts)
      The pretax credit amounts (ex: discount, credit grants, etc) for all line items.
    • setReason

      public void setReason(String reason)
      Reason for issuing this credit note, one of duplicate, fraudulent, order_change, or product_unsatisfactory.
    • setRefunds

      public void setRefunds(List<CreditNote.Refund> refunds)
      Refunds related to this credit note.
    • setShippingCost

      public void setShippingCost(CreditNote.ShippingCost shippingCost)
      The details of the cost of shipping, including the ShippingRate applied to the invoice.
    • setStatus

      public void setStatus(String status)
      Status of this credit note, one of issued or void. Learn more about voiding credit notes.
    • setSubtotal

      public void setSubtotal(Long subtotal)
      The integer amount in cents (or local equivalent) representing the amount of the credit note, excluding exclusive tax and invoice level discounts.
    • setSubtotalExcludingTax

      public void setSubtotalExcludingTax(Long subtotalExcludingTax)
      The integer amount in cents (or local equivalent) representing the amount of the credit note, excluding all tax and invoice level discounts.
    • setTotal

      public void setTotal(Long total)
      The integer amount in cents (or local equivalent) representing the total amount of the credit note, including tax and all discount.
    • setTotalExcludingTax

      public void setTotalExcludingTax(Long totalExcludingTax)
      The integer amount in cents (or local equivalent) representing the total amount of the credit note, excluding tax, but including discounts.
    • setTotalTaxes

      public void setTotalTaxes(List<CreditNote.TotalTax> totalTaxes)
      The aggregate tax information for all line items.
    • setType

      public void setType(String type)
      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.
    • setVoidedAt

      public void setVoidedAt(Long voidedAt)
      The time that the credit note was voided.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getId

      public String getId()
      Unique identifier for the object.
      Specified by:
      getId in interface HasId
    • getMetadata

      public Map<String,String> getMetadata()
      Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
      Specified by:
      getMetadata in interface MetadataStore<CreditNote>