Stripe.CreditNote (stripity_stripe v2.17.3) View Source

Work with Stripe Credit Note objects.

You can:

  • Preview a credit note
  • Create a credit note
  • Retrieve a credit note
  • Update a credit note
  • Void a credit note
  • List credit notes

Stripe API reference: https://stripe.com/docs/api/credit_notes

Link to this section Summary

Functions

Create a credit note.

List all credit notes.

Preview a credit note. Stripe.CreditNote.preview(%{

Retrieve a Credit Note.

Update a credit note.

Void a credit note.

Link to this section Types

Specs

discount() :: %{amount: integer(), discount: String.t()}

Specs

t() :: %Stripe.CreditNote{
  amount: integer(),
  created: Stripe.timestamp(),
  currency: String.t(),
  customer: Stripe.id() | Stripe.Customer.t() | nil,
  customer_balance_transaction:
    Stripe.id() | Stripe.CustomerBalanceTransaction.t() | nil,
  discount_amount: integer(),
  discount_amounts: [discount()],
  id: Stripe.id(),
  invoice: Stripe.id() | Stripe.Invoice.t(),
  lines: Stripe.List.t(Stripe.CreditNoteLineItem.t()),
  livemode: boolean(),
  memo: String.t(),
  metadata: Stripe.Types.metadata(),
  number: String.t(),
  object: String.t(),
  out_of_band_amount: integer() | nil,
  pdf: String.t(),
  reason: String.t() | nil,
  refund: Stripe.id() | Stripe.Refund.t() | nil,
  status: String.t(),
  subtotal: integer(),
  tax_amounts: [tax_amount()],
  total: integer(),
  type: String.t(),
  voided_at: Stripe.timestamp()
}

Specs

tax_amount() :: %{
  amount: integer(),
  inclusive: boolean(),
  tax_rate: Stripe.id() | Stripe.TaxRate.t()
}

Link to this section Functions

Link to this function

create(params, opts \\ [])

View Source

Specs

create(params, Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()}
when params:
       %{
         :amount => number(),
         :invoice => Stripe.id(),
         optional(:credit_amount) => number(),
         optional(:memo) => String.t(),
         optional(:metadata) => Stripe.Types.metadata(),
         optional(:reason) => String.t(),
         optional(:refund_amount) => number(),
         optional(:refund) => Stripe.id()
       }
       | %{}

Create a credit note.

Stripe.CreditNote.create(%{

invoice: "in_173uNd4Wq104wst7Gf4dgq1Y",
amount: 500,

})

Link to this function

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

View Source

Specs

list(params, Stripe.options()) ::
  {:ok, Stripe.List.t(t())} | {:error, Stripe.Error.t()}
when params:
       %{
         optional(:ending_before) => t() | Stripe.id(),
         optional(:limit) => 1..100,
         optional(:invoice) => Stripe.id(),
         optional(:starting_after) => t() | Stripe.id()
       }
       | %{}

List all credit notes.

Stripe.CreditNote.list(limit: 3)

Link to this function

preview(params, opts \\ [])

View Source

Specs

preview(params, Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()}
when params:
       %{
         :amount => number(),
         :invoice => Stripe.id(),
         optional(:credit_amount) => number(),
         optional(:memo) => String.t(),
         optional(:metadata) => Stripe.Types.metadata(),
         optional(:reason) => String.t(),
         optional(:refund_amount) => number(),
         optional(:refund) => Stripe.id()
       }
       | %{}

Preview a credit note. Stripe.CreditNote.preview(%{

invoice: "in_173uNd4Wq104wst7Gf4dgq1Y",
amount: 500,

})

Link to this function

retrieve(id, opts \\ [])

View Source

Specs

retrieve(Stripe.id() | t(), Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}

Retrieve a Credit Note.

Stripe.CreditNote.retrieve("cn_1EXwJk4Wq104wst7IISdh9ed")

Link to this function

update(id, params, opts \\ [])

View Source

Specs

update(Stripe.id() | t(), params, Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}
when params:
       %{
         optional(:memo) => String.t(),
         optional(:metadata) => Stripe.Types.metadata()
       }
       | %{}

Update a credit note.

Takes the id and a map of changes.

Stripe.CreditNote.update(

"cn_1EXwJk4Wq104wst7IISdh9ed",
%{
  metadata: {order_id: "6735"},
}

)

Specs

void(Stripe.id() | t(), Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}

Void a credit note.

Stripe.CreditNote.void("cn_1EXwJk4Wq104wst7IISdh9ed")