Search documentation of stripe_elixir

# StripeElixir.Services.CreditNoteService (stripe_elixir v0.1.0)

Copy Markdown View Source

CreditNote

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

Related guide: Credit notes

## Summary

### Functions

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

Create a credit note

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

List all credit notes

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

Preview a credit note

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

Retrieve a credit note

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

Update a credit note

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

Void a credit note

## Functions

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

    @spec create(StripeElixir.Client.t(), map(), keyword()) ::
      {:ok, term()} | {:error, StripeElixir.Error.t()}

Create a credit note

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.

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

    @spec list(StripeElixir.Client.t(), map(), keyword()) ::
      {:ok, term()} | {:error, StripeElixir.Error.t()}

List all credit notes

Returns a list of credit notes.

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

    @spec preview(StripeElixir.Client.t(), map(), keyword()) ::
      {:ok, term()} | {:error, StripeElixir.Error.t()}

Preview a credit note

Get a preview of a credit note without creating it.

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

    @spec retrieve(StripeElixir.Client.t(), String.t(), map(), keyword()) ::
      {:ok, term()} | {:error, StripeElixir.Error.t()}

Retrieve a credit note

Retrieves the credit note object with the given identifier.

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

    @spec update(StripeElixir.Client.t(), String.t(), map(), keyword()) ::
      {:ok, term()} | {:error, StripeElixir.Error.t()}

Update a credit note

Updates an existing credit note.

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

    @spec void_credit_note(StripeElixir.Client.t(), String.t(), map(), keyword()) ::
      {:ok, term()} | {:error, StripeElixir.Error.t()}

Void a credit note

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