Class: Stripe::Invoice
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::Invoice
- Extended by:
- APIOperations::Create, APIOperations::List, APIOperations::NestedResource, APIOperations::Search
- Includes:
- APIOperations::Delete, APIOperations::Save
- Defined in:
- lib/stripe/resources/invoice.rb
Overview
Invoices are statements of amounts owed by a customer, and are either generated one-off, or generated periodically from a subscription.
They contain [invoice items](stripe.com/docs/api#invoiceitems), and proration adjustments that may be caused by subscription upgrades/downgrades (if necessary).
If your invoice is configured to be billed through automatic charges, Stripe automatically finalizes your invoice and attempts payment. Note that finalizing the invoice, [when automatic](stripe.com/docs/invoicing/integration/automatic-advancement-collection), does not happen immediately as the invoice is created. Stripe waits until one hour after the last webhook was successfully sent (or the last webhook timed out after failing). If you (and the platforms you may have connected to) have no webhooks configured, Stripe waits one hour after creation to finalize the invoice.
If your invoice is configured to be billed by sending an email, then based on your [email settings](dashboard.stripe.com/account/billing/automatic), Stripe will email the invoice to your customer and await payment. These emails can contain a link to a hosted page to pay the invoice.
Stripe applies any customer credit on the account before determining the amount due for the invoice (i.e., the amount that will be actually charged). If the amount due for the invoice is less than Stripe’s [minimum allowed charge per currency](stripe.com/docs/currencies#minimum-and-maximum-charge-amounts), the invoice is automatically marked paid, and we add the amount due to the customer’s credit balance which is applied to the next invoice.
More details on the customer’s credit balance are [here](stripe.com/docs/billing/customer/balance).
Related guide: [Send invoices to customers](stripe.com/docs/billing/invoices/sending)
Constant Summary collapse
- OBJECT_NAME =
"invoice"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
-
.add_lines(invoice, params = {}, opts = {}) ⇒ Object
Adds multiple line items to an invoice.
-
.attach_payment(invoice, params = {}, opts = {}) ⇒ Object
Attaches a PaymentIntent or an Out of Band Payment to the invoice, adding it to the list of payments.
-
.attach_payment_intent(invoice, params = {}, opts = {}) ⇒ Object
Attaches a PaymentIntent to the invoice, adding it to the list of payments.
-
.create(params = {}, opts = {}) ⇒ Object
This endpoint creates a draft invoice for a given customer.
-
.create_preview(params = {}, opts = {}) ⇒ Object
At any time, you can preview the upcoming invoice for a customer.
-
.delete(id, params = {}, opts = {}) ⇒ Object
Permanently deletes a one-off invoice draft.
-
.finalize_invoice(invoice, params = {}, opts = {}) ⇒ Object
Stripe automatically finalizes drafts before sending and attempting payment on invoices.
-
.list(filters = {}, opts = {}) ⇒ Object
You can list all invoices, or list the invoices for a specific customer.
-
.list_upcoming_line_items(params = {}, opts = {}) ⇒ Object
When retrieving an upcoming invoice, you’ll get a lines property containing the total count of line items and the first handful of those items.
-
.mark_uncollectible(invoice, params = {}, opts = {}) ⇒ Object
Marking an invoice as uncollectible is useful for keeping track of bad debts that can be written off for accounting purposes.
- .object_name ⇒ Object
-
.pay(invoice, params = {}, opts = {}) ⇒ Object
Stripe automatically creates and then attempts to collect payment on invoices for customers on subscriptions according to your [subscriptions settings](dashboard.stripe.com/account/billing/automatic).
-
.remove_lines(invoice, params = {}, opts = {}) ⇒ Object
Removes multiple line items from an invoice.
- .search(params = {}, opts = {}) ⇒ Object
- .search_auto_paging_each(params = {}, opts = {}, &blk) ⇒ Object
-
.send_invoice(invoice, params = {}, opts = {}) ⇒ Object
Stripe will automatically send invoices to customers according to your [subscriptions settings](dashboard.stripe.com/account/billing/automatic).
-
.upcoming(params = {}, opts = {}) ⇒ Object
At any time, you can preview the upcoming invoice for a customer.
-
.update(id, params = {}, opts = {}) ⇒ Object
Draft invoices are fully editable.
-
.update_lines(invoice, params = {}, opts = {}) ⇒ Object
Updates multiple line items on an invoice.
-
.void_invoice(invoice, params = {}, opts = {}) ⇒ Object
Mark a finalized invoice as void.
Instance Method Summary collapse
-
#add_lines(params = {}, opts = {}) ⇒ Object
Adds multiple line items to an invoice.
-
#attach_payment(params = {}, opts = {}) ⇒ Object
Attaches a PaymentIntent or an Out of Band Payment to the invoice, adding it to the list of payments.
-
#attach_payment_intent(params = {}, opts = {}) ⇒ Object
Attaches a PaymentIntent to the invoice, adding it to the list of payments.
-
#delete(params = {}, opts = {}) ⇒ Object
Permanently deletes a one-off invoice draft.
-
#finalize_invoice(params = {}, opts = {}) ⇒ Object
Stripe automatically finalizes drafts before sending and attempting payment on invoices.
-
#mark_uncollectible(params = {}, opts = {}) ⇒ Object
Marking an invoice as uncollectible is useful for keeping track of bad debts that can be written off for accounting purposes.
-
#pay(params = {}, opts = {}) ⇒ Object
Stripe automatically creates and then attempts to collect payment on invoices for customers on subscriptions according to your [subscriptions settings](dashboard.stripe.com/account/billing/automatic).
-
#remove_lines(params = {}, opts = {}) ⇒ Object
Removes multiple line items from an invoice.
-
#send_invoice(params = {}, opts = {}) ⇒ Object
Stripe will automatically send invoices to customers according to your [subscriptions settings](dashboard.stripe.com/account/billing/automatic).
-
#update_lines(params = {}, opts = {}) ⇒ Object
Updates multiple line items on an invoice.
-
#void_invoice(params = {}, opts = {}) ⇒ Object
Mark a finalized invoice as void.
Methods included from APIOperations::Create
Methods included from APIOperations::List
Methods included from APIOperations::NestedResource
Methods included from APIOperations::Search
Methods included from APIOperations::Save
Methods included from APIOperations::Delete
Methods inherited from APIResource
class_name, custom_method, #refresh, #request_stripe_object, resource_url, #resource_url, retrieve, save_nested_resource
Methods included from APIOperations::Request
Methods inherited from StripeObject
#==, #[], #[]=, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values
Constructor Details
This class inherits a constructor from Stripe::StripeObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject
Class Method Details
.add_lines(invoice, params = {}, opts = {}) ⇒ Object
Adds multiple line items to an invoice. This is only possible when an invoice is still a draft.
64 65 66 67 68 69 70 71 |
# File 'lib/stripe/resources/invoice.rb', line 64 def self.add_lines(invoice, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/invoices/%<invoice>s/add_lines", { invoice: CGI.escape(invoice) }), params: params, opts: opts ) end |
.attach_payment(invoice, params = {}, opts = {}) ⇒ Object
Attaches a PaymentIntent or an Out of Band Payment to the invoice, adding it to the list of payments.
For Out of Band Payment, the payment is credited to the invoice immediately, increasing the amount_paid of the invoice and subsequently transitioning the status of the invoice to paid if necessary.
For the PaymentIntent, when the PaymentIntent’s status changes to succeeded, the payment is credited to the invoice, increasing its amount_paid. When the invoice is fully paid, the invoice’s status becomes paid.
If the PaymentIntent’s status is already succeeded when it’s attached, it’s credited to the invoice immediately.
See: [Create an invoice payment](stripe.com/docs/invoicing/payments/create) to learn more.
108 109 110 111 112 113 114 115 |
# File 'lib/stripe/resources/invoice.rb', line 108 def self.attach_payment(invoice, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/invoices/%<invoice>s/attach_payment", { invoice: CGI.escape(invoice) }), params: params, opts: opts ) end |
.attach_payment_intent(invoice, params = {}, opts = {}) ⇒ Object
Attaches a PaymentIntent to the invoice, adding it to the list of payments. When the PaymentIntent’s status changes to succeeded, the payment is credited to the invoice, increasing its amount_paid. When the invoice is fully paid, the invoice’s status becomes paid.
If the PaymentIntent’s status is already succeeded when it is attached, it is credited to the invoice immediately.
Related guide: [Create an invoice payment](stripe.com/docs/invoicing/payments/create)
144 145 146 147 148 149 150 151 |
# File 'lib/stripe/resources/invoice.rb', line 144 def self.attach_payment_intent(invoice, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/invoices/%<invoice>s/attach_payment_intent", { invoice: CGI.escape(invoice) }), params: params, opts: opts ) end |
.create(params = {}, opts = {}) ⇒ Object
This endpoint creates a draft invoice for a given customer. The invoice remains a draft until you [finalize the invoice, which allows you to [pay](#pay_invoice) or <a href=“#send_invoice”>send](stripe.com/docs/api#finalize_invoice) the invoice to your customers.
154 155 156 |
# File 'lib/stripe/resources/invoice.rb', line 154 def self.create(params = {}, opts = {}) request_stripe_object(method: :post, path: "/v1/invoices", params: params, opts: opts) end |
.create_preview(params = {}, opts = {}) ⇒ Object
At any time, you can preview the upcoming invoice for a customer. This will show you all the charges that are pending, including subscription renewal charges, invoice item charges, etc. It will also show you any discounts that are applicable to the invoice.
Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the invoice has not yet been created. As such, the upcoming invoice will not show up in invoice listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the amount that your customer will be billed, you can add, remove, or update pending invoice items, or update the customer’s discount.
You can preview the effects of updating a subscription, including a preview of what proration will take place. To ensure that the actual proration is calculated exactly the same as the previewed proration, you should pass the subscription_details.proration_date parameter when doing the actual subscription update. The recommended way to get only the prorations being previewed is to consider only proration line items where period is equal to the subscription_details.proration_date value passed in the request.
Note: Currency conversion calculations use the latest exchange rates. Exchange rates may vary between the time of the preview and the time of the actual invoice creation. [Learn more](docs.stripe.com/currencies/conversions)
165 166 167 168 169 170 171 172 |
# File 'lib/stripe/resources/invoice.rb', line 165 def self.create_preview(params = {}, opts = {}) request_stripe_object( method: :post, path: "/v1/invoices/create_preview", params: params, opts: opts ) end |
.delete(id, params = {}, opts = {}) ⇒ Object
Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices that are no longer in a draft state will fail; once an invoice has been finalized or if an invoice is for a subscription, it must be [voided](stripe.com/docs/api#void_invoice).
175 176 177 178 179 180 181 182 |
# File 'lib/stripe/resources/invoice.rb', line 175 def self.delete(id, params = {}, opts = {}) request_stripe_object( method: :delete, path: format("/v1/invoices/%<id>s", { id: CGI.escape(id) }), params: params, opts: opts ) end |
.finalize_invoice(invoice, params = {}, opts = {}) ⇒ Object
Stripe automatically finalizes drafts before sending and attempting payment on invoices. However, if you’d like to finalize a draft invoice manually, you can do so using this method.
205 206 207 208 209 210 211 212 |
# File 'lib/stripe/resources/invoice.rb', line 205 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 |
.list(filters = {}, opts = {}) ⇒ Object
You can list all invoices, or list the invoices for a specific customer. The invoices are returned sorted by creation date, with the most recently created invoices appearing first.
215 216 217 |
# File 'lib/stripe/resources/invoice.rb', line 215 def self.list(filters = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/invoices", params: filters, opts: opts) end |
.list_upcoming_line_items(params = {}, opts = {}) ⇒ Object
When retrieving an upcoming invoice, you’ll get a lines property containing the total count of line items and the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
220 221 222 223 224 225 226 227 |
# File 'lib/stripe/resources/invoice.rb', line 220 def self.list_upcoming_line_items(params = {}, opts = {}) request_stripe_object( method: :get, path: "/v1/invoices/upcoming/lines", params: params, opts: opts ) end |
.mark_uncollectible(invoice, params = {}, opts = {}) ⇒ Object
Marking an invoice as uncollectible is useful for keeping track of bad debts that can be written off for accounting purposes.
240 241 242 243 244 245 246 247 |
# File 'lib/stripe/resources/invoice.rb', line 240 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 |
.object_name ⇒ Object
46 47 48 |
# File 'lib/stripe/resources/invoice.rb', line 46 def self.object_name "invoice" end |
.pay(invoice, params = {}, opts = {}) ⇒ Object
Stripe automatically creates and then attempts to collect payment on invoices for customers on subscriptions according to your [subscriptions settings](dashboard.stripe.com/account/billing/automatic). However, if you’d like to attempt payment on an invoice out of the normal collection schedule or for some other reason, you can do so.
260 261 262 263 264 265 266 267 |
# File 'lib/stripe/resources/invoice.rb', line 260 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 |
.remove_lines(invoice, params = {}, opts = {}) ⇒ Object
Removes multiple line items from an invoice. This is only possible when an invoice is still a draft.
280 281 282 283 284 285 286 287 |
# File 'lib/stripe/resources/invoice.rb', line 280 def self.remove_lines(invoice, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/invoices/%<invoice>s/remove_lines", { invoice: CGI.escape(invoice) }), params: params, opts: opts ) end |
.search(params = {}, opts = {}) ⇒ Object
289 290 291 |
# File 'lib/stripe/resources/invoice.rb', line 289 def self.search(params = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/invoices/search", params: params, opts: opts) end |
.search_auto_paging_each(params = {}, opts = {}, &blk) ⇒ Object
293 294 295 |
# File 'lib/stripe/resources/invoice.rb', line 293 def self.search_auto_paging_each(params = {}, opts = {}, &blk) search(params, opts).auto_paging_each(&blk) end |
.send_invoice(invoice, params = {}, opts = {}) ⇒ Object
Stripe will automatically send invoices to customers according to your [subscriptions settings](dashboard.stripe.com/account/billing/automatic). However, if you’d like to manually send an invoice to your customer out of the normal schedule, you can do so. When sending invoices that have already been paid, there will be no reference to the payment in the email.
Requests made in test-mode result in no emails being sent, despite sending an invoice.sent event.
312 313 314 315 316 317 318 319 |
# File 'lib/stripe/resources/invoice.rb', line 312 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 |
.upcoming(params = {}, opts = {}) ⇒ Object
At any time, you can preview the upcoming invoice for a customer. This will show you all the charges that are pending, including subscription renewal charges, invoice item charges, etc. It will also show you any discounts that are applicable to the invoice.
Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the invoice has not yet been created. As such, the upcoming invoice will not show up in invoice listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the amount that your customer will be billed, you can add, remove, or update pending invoice items, or update the customer’s discount.
You can preview the effects of updating a subscription, including a preview of what proration will take place. To ensure that the actual proration is calculated exactly the same as the previewed proration, you should pass the subscription_details.proration_date parameter when doing the actual subscription update. The recommended way to get only the prorations being previewed is to consider only proration line items where period is equal to the subscription_details.proration_date value passed in the request.
Note: Currency conversion calculations use the latest exchange rates. Exchange rates may vary between the time of the preview and the time of the actual invoice creation. [Learn more](docs.stripe.com/currencies/conversions)
328 329 330 |
# File 'lib/stripe/resources/invoice.rb', line 328 def self.upcoming(params = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/invoices/upcoming", params: params, opts: opts) end |
.update(id, params = {}, opts = {}) ⇒ Object
Draft invoices are fully editable. Once an invoice is [finalized](stripe.com/docs/billing/invoices/workflow#finalized), monetary values, as well as collection_method, become uneditable.
If you would like to stop the Stripe Billing engine from automatically finalizing, reattempting payments on, sending reminders for, or [automatically reconciling](stripe.com/docs/billing/invoices/reconciliation) invoices, pass auto_advance=false.
338 339 340 341 342 343 344 345 |
# File 'lib/stripe/resources/invoice.rb', line 338 def self.update(id, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/invoices/%<id>s", { id: CGI.escape(id) }), params: params, opts: opts ) end |
.update_lines(invoice, params = {}, opts = {}) ⇒ Object
Updates multiple line items on an invoice. This is only possible when an invoice is still a draft.
358 359 360 361 362 363 364 365 |
# File 'lib/stripe/resources/invoice.rb', line 358 def self.update_lines(invoice, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/invoices/%<invoice>s/update_lines", { invoice: CGI.escape(invoice) }), params: params, opts: opts ) end |
.void_invoice(invoice, params = {}, opts = {}) ⇒ Object
Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to [deletion](stripe.com/docs/api#delete_invoice), however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found.
Consult with local regulations to determine whether and how an invoice might be amended, canceled, or voided in the jurisdiction you’re doing business in. You might need to [issue another invoice or <a href=“#create_credit_note”>credit note](stripe.com/docs/api#create_invoice) instead. Stripe recommends that you consult with your legal counsel for advice specific to your business.
382 383 384 385 386 387 388 389 |
# File 'lib/stripe/resources/invoice.rb', line 382 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 |
Instance Method Details
#add_lines(params = {}, opts = {}) ⇒ Object
Adds multiple line items to an invoice. This is only possible when an invoice is still a draft.
54 55 56 57 58 59 60 61 |
# File 'lib/stripe/resources/invoice.rb', line 54 def add_lines(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/invoices/%<invoice>s/add_lines", { invoice: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#attach_payment(params = {}, opts = {}) ⇒ Object
Attaches a PaymentIntent or an Out of Band Payment to the invoice, adding it to the list of payments.
For Out of Band Payment, the payment is credited to the invoice immediately, increasing the amount_paid of the invoice and subsequently transitioning the status of the invoice to paid if necessary.
For the PaymentIntent, when the PaymentIntent’s status changes to succeeded, the payment is credited to the invoice, increasing its amount_paid. When the invoice is fully paid, the invoice’s status becomes paid.
If the PaymentIntent’s status is already succeeded when it’s attached, it’s credited to the invoice immediately.
See: [Create an invoice payment](stripe.com/docs/invoicing/payments/create) to learn more.
86 87 88 89 90 91 92 93 |
# File 'lib/stripe/resources/invoice.rb', line 86 def attach_payment(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/invoices/%<invoice>s/attach_payment", { invoice: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#attach_payment_intent(params = {}, opts = {}) ⇒ Object
Attaches a PaymentIntent to the invoice, adding it to the list of payments. When the PaymentIntent’s status changes to succeeded, the payment is credited to the invoice, increasing its amount_paid. When the invoice is fully paid, the invoice’s status becomes paid.
If the PaymentIntent’s status is already succeeded when it is attached, it is credited to the invoice immediately.
Related guide: [Create an invoice payment](stripe.com/docs/invoicing/payments/create)
126 127 128 129 130 131 132 133 |
# File 'lib/stripe/resources/invoice.rb', line 126 def attach_payment_intent(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/invoices/%<invoice>s/attach_payment_intent", { invoice: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#delete(params = {}, opts = {}) ⇒ Object
Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices that are no longer in a draft state will fail; once an invoice has been finalized or if an invoice is for a subscription, it must be [voided](stripe.com/docs/api#void_invoice).
185 186 187 188 189 190 191 192 |
# File 'lib/stripe/resources/invoice.rb', line 185 def delete(params = {}, opts = {}) request_stripe_object( method: :delete, path: format("/v1/invoices/%<invoice>s", { invoice: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#finalize_invoice(params = {}, opts = {}) ⇒ Object
Stripe automatically finalizes drafts before sending and attempting payment on invoices. However, if you’d like to finalize a draft invoice manually, you can do so using this method.
195 196 197 198 199 200 201 202 |
# File 'lib/stripe/resources/invoice.rb', line 195 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 |
#mark_uncollectible(params = {}, opts = {}) ⇒ Object
Marking an invoice as uncollectible is useful for keeping track of bad debts that can be written off for accounting purposes.
230 231 232 233 234 235 236 237 |
# File 'lib/stripe/resources/invoice.rb', line 230 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 |
#pay(params = {}, opts = {}) ⇒ Object
Stripe automatically creates and then attempts to collect payment on invoices for customers on subscriptions according to your [subscriptions settings](dashboard.stripe.com/account/billing/automatic). However, if you’d like to attempt payment on an invoice out of the normal collection schedule or for some other reason, you can do so.
250 251 252 253 254 255 256 257 |
# File 'lib/stripe/resources/invoice.rb', line 250 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 |
#remove_lines(params = {}, opts = {}) ⇒ Object
Removes multiple line items from an invoice. This is only possible when an invoice is still a draft.
270 271 272 273 274 275 276 277 |
# File 'lib/stripe/resources/invoice.rb', line 270 def remove_lines(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/invoices/%<invoice>s/remove_lines", { invoice: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#send_invoice(params = {}, opts = {}) ⇒ Object
Stripe will automatically send invoices to customers according to your [subscriptions settings](dashboard.stripe.com/account/billing/automatic). However, if you’d like to manually send an invoice to your customer out of the normal schedule, you can do so. When sending invoices that have already been paid, there will be no reference to the payment in the email.
Requests made in test-mode result in no emails being sent, despite sending an invoice.sent event.
300 301 302 303 304 305 306 307 |
# File 'lib/stripe/resources/invoice.rb', line 300 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 |
#update_lines(params = {}, opts = {}) ⇒ Object
Updates multiple line items on an invoice. This is only possible when an invoice is still a draft.
348 349 350 351 352 353 354 355 |
# File 'lib/stripe/resources/invoice.rb', line 348 def update_lines(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/invoices/%<invoice>s/update_lines", { invoice: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#void_invoice(params = {}, opts = {}) ⇒ Object
Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to [deletion](stripe.com/docs/api#delete_invoice), however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found.
Consult with local regulations to determine whether and how an invoice might be amended, canceled, or voided in the jurisdiction you’re doing business in. You might need to [issue another invoice or <a href=“#create_credit_note”>credit note](stripe.com/docs/api#create_invoice) instead. Stripe recommends that you consult with your legal counsel for advice specific to your business.
370 371 372 373 374 375 376 377 |
# File 'lib/stripe/resources/invoice.rb', line 370 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 |