stripity_stripe v2.2.0 Stripe.Invoice View Source

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() View Source
t() :: %Stripe.Invoice{
  paid: boolean(),
  auto_advance: boolean(),
  invoice_pdf: String.t() | nil,
  billing_reason: String.t() | nil,
  metadata: Stripe.Types.metadata() | nil,
  discount: Stripe.Discount.t() | nil,
  date: Stripe.timestamp(),
  subtotal: integer(),
  application_fee: integer() | nil,
  tax_percent: integer() | nil,
  id: Stripe.id(),
  lines: Stripe.List.t(Stripe.LineItem.t()),
  amount_paid: integer(),
  period_end: Stripe.timestamp(),
  object: String.t(),
  attempted: boolean(),
  amount_remaining: integer(),
  currency: String.t(),
  receipt_number: String.t() | nil,
  due_date: Stripe.timestamp() | nil,
  description: String.t() | nil,
  statement_descriptor: String.t() | nil,
  charge: Stripe.id() | Stripe.Charge.t() | nil,
  closed: boolean(),
  tax: integer() | nil,
  livemode: boolean(),
  next_payment_attempt: Stripe.timestamp() | nil,
  starting_balance: integer(),
  customer: Stripe.id() | Stripe.Customer.t(),
  ending_balance: integer() | nil,
  billing: String.t() | nil,
  amount_due: integer(),
  period_start: Stripe.timestamp(),
  total: integer(),
  webhooks_delivered_at: Stripe.timestamp() | nil,
  forgiven: boolean(),
  hosted_invoice_url: String.t() | nil,
  number: String.t() | nil,
  subscription_proration_date: Stripe.timestamp(),
  subscription: Stripe.id() | Stripe.Subscription.t() | nil,
  attempt_count: non_neg_integer()
}

Link to this section Functions

Link to this function create(params, opts \\ []) View Source
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 \\ []) View Source
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 \\ []) View Source
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 \\ []) View Source
retrieve(Stripe.id() | t(), Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}

Retrieve an invoice.

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

Retrieve an upcoming invoice.

Link to this function update(id, params, opts \\ []) View Source
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.