stripity_stripe v2.2.3 Stripe.Invoice View Source

Work with Stripe invoice objects.

You can:

  • Create an invoice
  • Retrieve an invoice
  • Update an invoice
  • Void 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.

List all invoices.

Pay an invoice.

Retrieve an invoice.

Retrieve an upcoming invoice.

Update an invoice.

Void an invoice

Link to this section Types

Link to this type

custom_fields() View Source
custom_fields() :: [%{name: String.t(), value: String.t()}]

Link to this type

invoice_settings() View Source
invoice_settings() :: %{
  custom_fields: custom_fields() | nil,
  footer: String.t() | nil
}

Link to this type

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

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) => Stripe.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(:auto_advance) => boolean(),
         optional(:days_until_due) => integer(),
         optional(:default_source) => String.t(),
         optional(:description) => String.t(),
         optional(:due_date) => Stripe.timestamp(),
         optional(:footer) => String.t(),
         optional(:forgiven) => boolean(),
         optional(:metadata) => Stripe.Types.metadata(),
         optional(:paid) => boolean(),
         optional(:statement_descriptor) => String.t(),
         optional(:tax_percent) => number()
       }
       | %{}

Update an invoice.

Takes the id and a map of changes.

Link to this function

void(id, opts \\ []) View Source
void(Stripe.id() | t(), Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}

Void an invoice