class Stripe::Invoice

Related guide: [Send invoices to customers](https://stripe.com/docs/billing/invoices/sending)<br><br>(stripe.com/docs/billing/customer/balance).
More details on the customer’s credit balance are
customer’s credit balance which is applied to the next invoice.
invoice is automatically marked paid, and we add the amount due to the
per currency](stripe.com/docs/currencies#minimum-and-maximum-charge-amounts), the
charged). If the amount due for the invoice is less than Stripe’s [minimum allowed charge
amount due for the invoice (i.e., the amount that will be actually
Stripe applies any customer credit on the account before determining the
emails can contain a link to a hosted page to pay the invoice.
Stripe will email the invoice to your customer and await payment. These
[email settings](dashboard.stripe.com/account/billing/automatic),
If your invoice is configured to be billed by sending an email, then based on your
creation to finalize the invoice.
connected to) have no webhooks configured, Stripe waits one hour after
webhook timed out after failing). If you (and the platforms you may have
until one hour after the last webhook was successfully sent (or the last
not happen immediately as the invoice is created. Stripe waits
[when automatic](stripe.com/docs/billing/invoices/workflow/#auto_advance), does
that finalizing the invoice,
Stripe automatically finalizes your invoice and attempts payment. Note
If your invoice is configured to be billed through automatic charges,
that may be caused by subscription upgrades/downgrades (if necessary).
They contain [invoice items](stripe.com/docs/api#invoiceitems), and proration adjustments
generated one-off, or generated periodically from a subscription.
Invoices are statements of amounts owed by a customer, and are either

def self.finalize_invoice(invoice, params = {}, opts = {})

def self.finalize_invoice(invoice, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/invoices/%<invoice>s/finalize", { invoice: CGI.escape(invoice) }),
    params: params,
    opts: opts
  )
end

def self.list_upcoming_line_items(params = {}, opts = {})

def self.list_upcoming_line_items(params = {}, opts = {})
  request_stripe_object(
    method: :get,
    path: "/v1/invoices/upcoming/lines",
    params: params,
    opts: opts
  )
end

def self.mark_uncollectible(invoice, params = {}, opts = {})

def self.mark_uncollectible(invoice, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/invoices/%<invoice>s/mark_uncollectible", { invoice: CGI.escape(invoice) }),
    params: params,
    opts: opts
  )
end

def self.pay(invoice, params = {}, opts = {})

def self.pay(invoice, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/invoices/%<invoice>s/pay", { invoice: CGI.escape(invoice) }),
    params: params,
    opts: opts
  )
end

def self.search(params = {}, opts = {})

def self.search(params = {}, opts = {})
  _search("/v1/invoices/search", params, opts)
end

def self.search_auto_paging_each(params = {}, opts = {}, &blk)

def self.search_auto_paging_each(params = {}, opts = {}, &blk)
  search(params, opts).auto_paging_each(&blk)
end

def self.send_invoice(invoice, params = {}, opts = {})

def self.send_invoice(invoice, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/invoices/%<invoice>s/send", { invoice: CGI.escape(invoice) }),
    params: params,
    opts: opts
  )
end

def self.upcoming(params = {}, opts = {})

def self.upcoming(params = {}, opts = {})
  request_stripe_object(
    method: :get,
    path: "/v1/invoices/upcoming",
    params: params,
    opts: opts
  )
end

def self.void_invoice(invoice, params = {}, opts = {})

def self.void_invoice(invoice, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/invoices/%<invoice>s/void", { invoice: CGI.escape(invoice) }),
    params: params,
    opts: opts
  )
end

def finalize_invoice(params = {}, opts = {})

def finalize_invoice(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/invoices/%<invoice>s/finalize", { invoice: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end

def mark_uncollectible(params = {}, opts = {})

def mark_uncollectible(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/invoices/%<invoice>s/mark_uncollectible", { invoice: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end

def pay(params = {}, opts = {})

def pay(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/invoices/%<invoice>s/pay", { invoice: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end

def send_invoice(params = {}, opts = {})

def send_invoice(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/invoices/%<invoice>s/send", { invoice: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end

def void_invoice(params = {}, opts = {})

def void_invoice(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/invoices/%<invoice>s/void", { invoice: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end