stripity_stripe v2.0.1 Stripe.Invoice

Work with Stripe invoice objects.

You can:

  • Create an invoice
  • Retrieve an invoice
  • Update an invoice

Does not take options yet.

Stripe API reference: https://stripe.com/docs/api#invoice

Link to this section Summary

Functions

Create an invoice

Retrieve an invoice

Retrieve an upcoming invoice

Update an invoice

Link to this section Types

Link to this type t()
t() :: %Stripe.Invoice{
  application_fee: integer() | nil,
  metadata: Stripe.Types.metadata() | nil,
  date: Stripe.timestamp(),
  id: Stripe.id(),
  statement_descriptor: String.t() | nil,
  starting_balance: integer(),
  forgiven: boolean(),
  attempted: boolean(),
  amount_due: integer(),
  lines: Stripe.List.t(Stripe.LineItem.t()),
  next_payment_attempt: Stripe.timestamp() | nil,
  billing: String.t() | nil,
  tax_percent: integer() | nil,
  tax: integer() | nil,
  description: String.t() | nil,
  webhooks_delivered_at: Stripe.timestamp() | nil,
  closed: boolean(),
  livemode: boolean(),
  discount: Stripe.Discount.t() | nil,
  customer: Stripe.id() | Stripe.Customer.t(),
  paid: boolean(),
  period_end: Stripe.timestamp(),
  receipt_number: String.t() | nil,
  object: String.t(),
  period_start: Stripe.timestamp(),
  subscription_proration_date: Stripe.timestamp(),
  total: integer(),
  charge: Stripe.id() | Stripe.Charge.t() | nil,
  attempt_count: non_neg_integer(),
  currency: String.t(),
  subtotal: integer(),
  due_date: Stripe.timestamp() | nil,
  ending_balance: integer() | nil,
  subscription: Stripe.id() | Stripe.Subscription.t() | nil
}

Link to this section Functions

Link to this function create(params, opts \\ [])
create(params, Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()}
when params:
       %{
         optional(:application_fee) => integer(),
         optional(:billing) => String.t(),
         :customer => Stripe.id() | Stripe.Customer.t(),
         optional(:days_until_due) => integer(),
         optional(:description) => String.t(),
         optional(:due_date) => String.timestamp(),
         optional(:metadata) => Stripe.Types.metadata(),
         optional(:statement_descriptor) => String.t(),
         optional(:subscription) => Stripe.id() | Stripe.Subscription.t(),
         optional(:tax_percent) => integer()
       }
       | %{}

Create an invoice.

Link to this function list(params \\ %{}, opts \\ [])
list(params, Stripe.options()) ::
  {:ok, Stripe.List.t(t())} | {:error, Stripe.Error.t()}
when params:
       %{
         optional(:billing) => String.t(),
         optional(:customer) => Stripe.id() | Stripe.Customer.t(),
         optional(:date) => Stripe.date_query(),
         optional(:due_date) => String.timestamp(),
         optional(:ending_before) => t() | Stripe.id(),
         optional(:limit) => 1..100,
         optional(:starting_after) => t() | Stripe.id(),
         optional(:subscription) => Stripe.id() | Stripe.Subscription.t()
       }
       | %{}

List all invoices.

Link to this function pay(id, params, opts \\ [])
pay(Stripe.id() | t(), params, Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}
when params:
       %{
         :id => String.t(),
         optional(:forgive) => boolean(),
         optional(:source) => Stripe.id() | Stripe.Source.t() | nil
       }
       | %{}

Pay an invoice.

Link to this function retrieve(id, opts \\ [])
retrieve(Stripe.id() | t(), Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}

Retrieve an invoice.

Link to this function upcoming(params, opts \\ [])
upcoming(map(), Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()}

Retrieve an upcoming invoice.

Link to this function update(id, params, opts \\ [])
update(Stripe.id() | t(), params, Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}
when params:
       %{
         optional(:application_fee) => integer(),
         optional(:closed) => boolean(),
         optional(:days_until_due) => integer(),
         optional(:description) => String.t(),
         optional(:due_date) => String.timestamp(),
         optional(:forgiven) => boolean(),
         optional(:metadata) => Stripe.Types.metadata(),
         optional(:paid) => boolean(),
         optional(:statement_descriptor) => String.t(),
         optional(:tax_percent) => integer()
       }
       | %{}

Update an invoice.

Takes the id and a map of changes.