View Source Stripe.CreditNote (Striped v0.5.0) (generated)

Issue a credit note to adjust an invoice's amount after the invoice is finalized.

Related guide: Credit Notes.

Link to this section Summary

Types

t()

The credit_note type.

Functions

Issue a credit note to adjust the amount of a finalized invoice. For a status=open invoice, a credit note reducesits amount_due. For a status=paid invoice, a credit note does not affect its amount_due. Instead, it can result in any combination of the following.

Returns a list of credit notes.

Get a preview of a credit note without creating it.

When retrieving a credit note preview, you’ll get a lines property containing the first handful of those items. This URL you can retrieve the full (paginated) list of line items.

Retrieves the credit note object with the given identifier.

Updates an existing credit note.

Marks a credit note as void. Learn more about voiding credit notes.

Link to this section Types

@type lines() :: %{
  optional(:amount) => integer(),
  optional(:description) => binary(),
  optional(:invoice_line_item) => binary(),
  optional(:quantity) => integer(),
  optional(:tax_rates) => [binary()] | binary(),
  optional(:type) => :custom_line_item | :invoice_line_item,
  optional(:unit_amount) => integer(),
  optional(:unit_amount_decimal) => binary()
}
@type t() :: %Stripe.CreditNote{
  amount: integer(),
  created: integer(),
  currency: binary(),
  customer: binary() | Stripe.Customer.t() | Stripe.DeletedCustomer.t(),
  customer_balance_transaction:
    (binary() | Stripe.CustomerBalanceTransaction.t()) | nil,
  discount_amount: integer(),
  discount_amounts: term(),
  id: binary(),
  invoice: binary() | Stripe.Invoice.t(),
  lines: term(),
  livemode: boolean(),
  memo: binary() | nil,
  metadata: term() | nil,
  number: binary(),
  object: binary(),
  out_of_band_amount: integer() | nil,
  pdf: binary(),
  reason: binary() | nil,
  refund: (binary() | Stripe.Refund.t()) | nil,
  status: binary(),
  subtotal: integer(),
  subtotal_excluding_tax: integer() | nil,
  tax_amounts: term(),
  total: integer(),
  total_excluding_tax: integer() | nil,
  type: binary(),
  voided_at: integer() | nil
}

The credit_note type.

  • amount The integer amount in %s representing the total amount of the credit note, including tax.
  • created Time at which the object was created. Measured in seconds since the Unix epoch.
  • currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
  • customer ID of the customer.
  • customer_balance_transaction Customer balance transaction related to this credit note.
  • discount_amount The integer amount in %s representing the total amount of discount that was credited.
  • discount_amounts The aggregate amounts calculated per discount for all line items.
  • id Unique identifier for the object.
  • invoice ID of the invoice.
  • lines Line items that make up the credit note
  • livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode.
  • memo Customer-facing text that appears on the credit note PDF.
  • 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.
  • number A unique number that identifies this particular credit note and appears on the PDF of the credit note and its associated invoice.
  • object String representing the object's type. Objects of the same type share the same value.
  • out_of_band_amount Amount that was credited outside of Stripe.
  • pdf The link to download the PDF of the credit note.
  • reason Reason for issuing this credit note, one of duplicate, fraudulent, order_change, or product_unsatisfactory
  • refund Refund related to this credit note.
  • status Status of this credit note, one of issued or void. Learn more about voiding credit notes.
  • subtotal The integer amount in %s representing the amount of the credit note, excluding exclusive tax and invoice level discounts.
  • subtotal_excluding_tax The integer amount in %s representing the amount of the credit note, excluding all tax and invoice level discounts.
  • tax_amounts The aggregate amounts calculated per tax rate for all line items.
  • total The integer amount in %s representing the total amount of the credit note, including tax and all discount.
  • total_excluding_tax The integer amount in %s representing the total amount of the credit note, excluding tax, but including discounts.
  • 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.
  • voided_at The time that the credit note was voided.

Link to this section Functions

Link to this function

create(client, params \\ %{}, opts \\ [])

View Source
@spec create(
  client :: Stripe.t(),
  params :: %{
    optional(:amount) => integer(),
    optional(:credit_amount) => integer(),
    optional(:expand) => [binary()],
    optional(:invoice) => binary(),
    optional(:lines) => [lines()],
    optional(:memo) => binary(),
    optional(:metadata) => %{optional(binary()) => binary()},
    optional(:out_of_band_amount) => integer(),
    optional(:reason) =>
      :duplicate | :fraudulent | :order_change | :product_unsatisfactory,
    optional(:refund) => binary(),
    optional(:refund_amount) => integer()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Issue a credit note to adjust the amount of a finalized invoice. For a status=open invoice, a credit note reducesits amount_due. For a status=paid invoice, a credit note does not affect its amount_due. Instead, it can result in any combination of the following.

  • Refund: create a new refund (using refund_amount) or link an existing refund (using refund).
  • 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).

For post-payment credit notes the sum of the refund, credit and outside of Stripe amounts must equal the credit note total.

You may issue multiple credit notes for an invoice. Each credit note will increment the invoice’s pre_payment_credit_notes_amountor post_payment_credit_notes_amount depending on its status at the time of credit note creation.

Details

  • Method: post
  • Path: /v1/credit_notes
Link to this function

list(client, params \\ %{}, opts \\ [])

View Source
@spec list(
  client :: Stripe.t(),
  params :: %{
    optional(:customer) => binary(),
    optional(:ending_before) => binary(),
    optional(:expand) => [binary()],
    optional(:invoice) => binary(),
    optional(:limit) => integer(),
    optional(:starting_after) => binary()
  },
  opts :: Keyword.t()
) ::
  {:ok, Stripe.List.t(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Returns a list of credit notes.

Details

  • Method: get
  • Path: /v1/credit_notes
Link to this function

preview(client, params \\ %{}, opts \\ [])

View Source
@spec preview(
  client :: Stripe.t(),
  params :: %{
    optional(:amount) => integer(),
    optional(:credit_amount) => integer(),
    optional(:expand) => [binary()],
    optional(:invoice) => binary(),
    optional(:lines) => [lines()],
    optional(:memo) => binary(),
    optional(:metadata) => %{optional(binary()) => binary()},
    optional(:out_of_band_amount) => integer(),
    optional(:reason) =>
      :duplicate | :fraudulent | :order_change | :product_unsatisfactory,
    optional(:refund) => binary(),
    optional(:refund_amount) => integer()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Get a preview of a credit note without creating it.

Details

  • Method: get
  • Path: /v1/credit_notes/preview
Link to this function

preview_lines(client, params \\ %{}, opts \\ [])

View Source
@spec preview_lines(
  client :: Stripe.t(),
  params :: %{
    optional(:amount) => integer(),
    optional(:credit_amount) => integer(),
    optional(:ending_before) => binary(),
    optional(:expand) => [binary()],
    optional(:invoice) => binary(),
    optional(:limit) => integer(),
    optional(:lines) => [lines()],
    optional(:memo) => binary(),
    optional(:metadata) => %{optional(binary()) => binary()},
    optional(:out_of_band_amount) => integer(),
    optional(:reason) =>
      :duplicate | :fraudulent | :order_change | :product_unsatisfactory,
    optional(:refund) => binary(),
    optional(:refund_amount) => integer(),
    optional(:starting_after) => binary()
  },
  opts :: Keyword.t()
) ::
  {:ok, Stripe.List.t(Stripe.CreditNoteLineItem.t())}
  | {:error, Stripe.ApiErrors.t()}
  | {:error, term()}

When retrieving a credit note preview, you’ll get a lines property containing the first handful of those items. This URL you can retrieve the full (paginated) list of line items.

Details

  • Method: get
  • Path: /v1/credit_notes/preview/lines
Link to this function

retrieve(client, id, params \\ %{}, opts \\ [])

View Source
@spec retrieve(
  client :: Stripe.t(),
  id :: binary(),
  params :: %{optional(:expand) => [binary()]},
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Retrieves the credit note object with the given identifier.

Details

  • Method: get
  • Path: /v1/credit_notes/{id}
Link to this function

update(client, id, params \\ %{}, opts \\ [])

View Source
@spec update(
  client :: Stripe.t(),
  id :: binary(),
  params :: %{
    optional(:expand) => [binary()],
    optional(:memo) => binary(),
    optional(:metadata) => %{optional(binary()) => binary()}
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Updates an existing credit note.

Details

  • Method: post
  • Path: /v1/credit_notes/{id}
Link to this function

void_credit_note(client, id, params \\ %{}, opts \\ [])

View Source
@spec void_credit_note(
  client :: Stripe.t(),
  id :: binary(),
  params :: %{optional(:expand) => [binary()]},
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Marks a credit note as void. Learn more about voiding credit notes.

Details

  • Method: post
  • Path: /v1/credit_notes/{id}/void