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, 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, 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, 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, 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.
Related guide: Send invoices to customers
Defined Under Namespace
Classes: AutomaticTax, ConfirmationSecret, CustomField, CustomerAddress, CustomerShipping, CustomerTaxId, FromInvoice, Issuer, LastFinalizationError, Parent, PaymentSettings, Rendering, ShippingCost, ShippingDetails, StatusTransitions, ThresholdReason, TotalDiscountAmount, TotalPretaxCreditAmount, TotalTax
Constant Summary collapse
- OBJECT_NAME =
"invoice"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary collapse
-
#account_country ⇒ Object
readonly
The country of the business associated with this invoice, most often the business creating the invoice.
-
#account_name ⇒ Object
readonly
The public name of the business associated with this invoice, most often the business creating the invoice.
-
#account_tax_ids ⇒ Object
readonly
The account tax IDs associated with the invoice.
-
#amount_due ⇒ Object
readonly
Final amount due at this time for this invoice.
-
#amount_overpaid ⇒ Object
readonly
Amount that was overpaid on the invoice.
-
#amount_paid ⇒ Object
readonly
The amount, in cents (or local equivalent), that was paid.
-
#amount_remaining ⇒ Object
readonly
The difference between amount_due and amount_paid, in cents (or local equivalent).
-
#amount_shipping ⇒ Object
readonly
This is the sum of all the shipping amounts.
-
#application ⇒ Object
readonly
ID of the Connect Application that created the invoice.
-
#attempt_count ⇒ Object
readonly
Number of payment attempts made for this invoice, from the perspective of the payment retry schedule.
-
#attempted ⇒ Object
readonly
Whether an attempt has been made to pay the invoice.
-
#auto_advance ⇒ Object
readonly
Controls whether Stripe performs automatic collection of the invoice.
-
#automatic_tax ⇒ Object
readonly
Attribute for field automatic_tax.
-
#automatically_finalizes_at ⇒ Object
readonly
The time when this invoice is currently scheduled to be automatically finalized.
-
#billing_reason ⇒ Object
readonly
Indicates the reason why the invoice was created.
-
#collection_method ⇒ Object
readonly
Either
charge_automatically, orsend_invoice. -
#confirmation_secret ⇒ Object
readonly
The confirmation secret associated with this invoice.
-
#created ⇒ Object
readonly
Time at which the object was created.
-
#currency ⇒ Object
readonly
Three-letter ISO currency code, in lowercase.
-
#custom_fields ⇒ Object
readonly
Custom fields displayed on the invoice.
-
#customer ⇒ Object
readonly
The ID of the customer to bill.
-
#customer_account ⇒ Object
readonly
The ID of the account representing the customer to bill.
-
#customer_address ⇒ Object
readonly
The customer's address.
-
#customer_email ⇒ Object
readonly
The customer's email.
-
#customer_name ⇒ Object
readonly
The customer's name.
-
#customer_phone ⇒ Object
readonly
The customer's phone number.
-
#customer_shipping ⇒ Object
readonly
The customer's shipping information.
-
#customer_tax_exempt ⇒ Object
readonly
The customer's tax exempt status.
-
#customer_tax_ids ⇒ Object
readonly
The customer's tax IDs.
-
#default_payment_method ⇒ Object
readonly
ID of the default payment method for the invoice.
-
#default_source ⇒ Object
readonly
ID of the default payment source for the invoice.
-
#default_tax_rates ⇒ Object
readonly
The tax rates applied to this invoice, if any.
-
#deleted ⇒ Object
readonly
Always true for a deleted object.
-
#description ⇒ Object
readonly
An arbitrary string attached to the object.
-
#discounts ⇒ Object
readonly
The discounts applied to the invoice.
-
#due_date ⇒ Object
readonly
The date on which payment for this invoice is due.
-
#effective_at ⇒ Object
readonly
The date when this invoice is in effect.
-
#ending_balance ⇒ Object
readonly
Ending customer balance after the invoice is finalized.
-
#footer ⇒ Object
readonly
Footer displayed on the invoice.
-
#from_invoice ⇒ Object
readonly
Details of the invoice that was cloned.
-
#hosted_invoice_url ⇒ Object
readonly
The URL for the hosted invoice page, which allows customers to view and pay an invoice.
-
#id ⇒ Object
readonly
Unique identifier for the object.
-
#invoice_pdf ⇒ Object
readonly
The link to download the PDF for the invoice.
-
#issuer ⇒ Object
readonly
Attribute for field issuer.
-
#last_finalization_error ⇒ Object
readonly
The error encountered during the previous attempt to finalize the invoice.
-
#latest_revision ⇒ Object
readonly
The ID of the most recent non-draft revision of this invoice.
-
#lines ⇒ Object
readonly
The individual line items that make up the invoice.
-
#livemode ⇒ Object
readonly
If the object exists in live mode, the value is
true. -
#metadata ⇒ Object
readonly
Set of key-value pairs that you can attach to an object.
-
#next_payment_attempt ⇒ Object
readonly
The time at which payment will next be attempted.
-
#number ⇒ Object
readonly
A unique, identifying string that appears on emails sent to the customer for this invoice.
-
#object ⇒ Object
readonly
String representing the object's type.
-
#on_behalf_of ⇒ Object
readonly
The account (if any) for which the funds of the invoice payment are intended.
-
#parent ⇒ Object
readonly
The parent that generated this invoice.
-
#payment_settings ⇒ Object
readonly
Attribute for field payment_settings.
-
#payments ⇒ Object
readonly
Payments for this invoice.
-
#period_end ⇒ Object
readonly
The latest timestamp at which invoice items can be associated with this invoice.
-
#period_start ⇒ Object
readonly
The earliest timestamp at which invoice items can be associated with this invoice.
-
#post_payment_credit_notes_amount ⇒ Object
readonly
Total amount of all post-payment credit notes issued for this invoice.
-
#pre_payment_credit_notes_amount ⇒ Object
readonly
Total amount of all pre-payment credit notes issued for this invoice.
-
#receipt_number ⇒ Object
readonly
This is the transaction number that appears on email receipts sent for this invoice.
-
#rendering ⇒ Object
readonly
The rendering-related settings that control how the invoice is displayed on customer-facing surfaces such as PDF and Hosted Invoice Page.
-
#shipping_cost ⇒ Object
readonly
The details of the cost of shipping, including the ShippingRate applied on the invoice.
-
#shipping_details ⇒ Object
readonly
Shipping details for the invoice.
-
#starting_balance ⇒ Object
readonly
Starting customer balance before the invoice is finalized.
-
#statement_descriptor ⇒ Object
readonly
Extra information about an invoice for the customer's credit card statement.
-
#status ⇒ Object
readonly
The status of the invoice, one of
draft,open,paid,uncollectible, orvoid. -
#status_transitions ⇒ Object
readonly
Attribute for field status_transitions.
-
#subtotal ⇒ Object
readonly
Total of all subscriptions, invoice items, and prorations on the invoice before any invoice level discount or exclusive tax is applied.
-
#subtotal_excluding_tax ⇒ Object
readonly
The integer amount in cents (or local equivalent) representing the subtotal of the invoice before any invoice level discount or tax is applied.
-
#test_clock ⇒ Object
readonly
ID of the test clock this invoice belongs to.
-
#threshold_reason ⇒ Object
readonly
Attribute for field threshold_reason.
-
#total ⇒ Object
readonly
Total after discounts and taxes.
-
#total_discount_amounts ⇒ Object
readonly
The aggregate amounts calculated per discount across all line items.
-
#total_excluding_tax ⇒ Object
readonly
The integer amount in cents (or local equivalent) representing the total amount of the invoice including all discounts but excluding all tax.
-
#total_pretax_credit_amounts ⇒ Object
readonly
Contains pretax credit amounts (ex: discount, credit grants, etc) that apply to this invoice.
-
#total_taxes ⇒ Object
readonly
The aggregate tax information of all line items.
-
#webhooks_delivered_at ⇒ Object
readonly
Invoices are automatically paid or sent 1 hour after webhooks are delivered, or until all webhook delivery attempts have been exhausted.
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.
-
.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 subscription or subscription schedule.
-
.delete(invoice, params = {}, opts = {}) ⇒ Object
Permanently deletes a one-off invoice draft.
- .field_remappings ⇒ Object
-
.finalize_invoice(invoice, params = {}, opts = {}) ⇒ Object
Stripe automatically finalizes drafts before sending and attempting payment on invoices.
- .inner_class_types ⇒ Object
-
.list(params = {}, opts = {}) ⇒ Object
You can list all invoices, or list the invoices for a specific customer.
-
.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.
-
.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.
-
.update(invoice, 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.
-
#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.
-
#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.
-
#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
#==, #[], #[]=, #_get_inner_class_type, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, field_encodings, #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
Instance Attribute Details
#account_country ⇒ Object (readonly)
The country of the business associated with this invoice, most often the business creating the invoice.
890 891 892 |
# File 'lib/stripe/resources/invoice.rb', line 890 def account_country @account_country end |
#account_name ⇒ Object (readonly)
The public name of the business associated with this invoice, most often the business creating the invoice.
892 893 894 |
# File 'lib/stripe/resources/invoice.rb', line 892 def account_name @account_name end |
#account_tax_ids ⇒ Object (readonly)
The account tax IDs associated with the invoice. Only editable when the invoice is a draft.
894 895 896 |
# File 'lib/stripe/resources/invoice.rb', line 894 def account_tax_ids @account_tax_ids end |
#amount_due ⇒ Object (readonly)
Final amount due at this time for this invoice. If the invoice's total is smaller than the minimum charge amount, for example, or if there is account credit that can be applied to the invoice, the amount_due may be 0. If there is a positive starting_balance for the invoice (the customer owes money), the amount_due will also take that into account. The charge that gets generated for the invoice will be for the amount specified in amount_due.
896 897 898 |
# File 'lib/stripe/resources/invoice.rb', line 896 def amount_due @amount_due end |
#amount_overpaid ⇒ Object (readonly)
Amount that was overpaid on the invoice. The amount overpaid is credited to the customer's credit balance.
898 899 900 |
# File 'lib/stripe/resources/invoice.rb', line 898 def amount_overpaid @amount_overpaid end |
#amount_paid ⇒ Object (readonly)
The amount, in cents (or local equivalent), that was paid.
900 901 902 |
# File 'lib/stripe/resources/invoice.rb', line 900 def amount_paid @amount_paid end |
#amount_remaining ⇒ Object (readonly)
The difference between amount_due and amount_paid, in cents (or local equivalent).
902 903 904 |
# File 'lib/stripe/resources/invoice.rb', line 902 def amount_remaining @amount_remaining end |
#amount_shipping ⇒ Object (readonly)
This is the sum of all the shipping amounts.
904 905 906 |
# File 'lib/stripe/resources/invoice.rb', line 904 def amount_shipping @amount_shipping end |
#application ⇒ Object (readonly)
ID of the Connect Application that created the invoice.
906 907 908 |
# File 'lib/stripe/resources/invoice.rb', line 906 def application @application end |
#attempt_count ⇒ Object (readonly)
Number of payment attempts made for this invoice, from the perspective of the payment retry schedule. Any payment attempt counts as the first attempt, and subsequently only automatic retries increment the attempt count. In other words, manual payment attempts after the first attempt do not affect the retry schedule. If a failure is returned with a non-retryable return code, the invoice can no longer be retried unless a new payment method is obtained. Retries will continue to be scheduled, and attempt_count will continue to increment, but retries will only be executed if a new payment method is obtained.
908 909 910 |
# File 'lib/stripe/resources/invoice.rb', line 908 def attempt_count @attempt_count end |
#attempted ⇒ Object (readonly)
Whether an attempt has been made to pay the invoice. An invoice is not attempted until 1 hour after the invoice.created webhook, for example, so you might not want to display that invoice as unpaid to your users.
910 911 912 |
# File 'lib/stripe/resources/invoice.rb', line 910 def attempted @attempted end |
#auto_advance ⇒ Object (readonly)
Controls whether Stripe performs automatic collection of the invoice. If false, the invoice's state doesn't automatically advance without an explicit action.
912 913 914 |
# File 'lib/stripe/resources/invoice.rb', line 912 def auto_advance @auto_advance end |
#automatic_tax ⇒ Object (readonly)
Attribute for field automatic_tax
914 915 916 |
# File 'lib/stripe/resources/invoice.rb', line 914 def automatic_tax @automatic_tax end |
#automatically_finalizes_at ⇒ Object (readonly)
The time when this invoice is currently scheduled to be automatically finalized. The field will be null if the invoice is not scheduled to finalize in the future. If the invoice is not in the draft state, this field will always be null - see finalized_at for the time when an already-finalized invoice was finalized.
916 917 918 |
# File 'lib/stripe/resources/invoice.rb', line 916 def automatically_finalizes_at @automatically_finalizes_at end |
#billing_reason ⇒ Object (readonly)
Indicates the reason why the invoice was created.
manual: Unrelated to a subscription, for example, created via the invoice editor.subscription: No longer in use. Applies to subscriptions from before May 2018 where no distinction was made between updates, cycles, and thresholds.subscription_create: A new subscription was created.subscription_cycle: A subscription advanced into a new period.subscription_threshold: A subscription reached a billing threshold.subscription_update: A subscription was updated.upcoming: Reserved for upcoming invoices created through the Create Preview Invoice API or when aninvoice.upcomingevent is generated for an upcoming invoice on a subscription.
926 927 928 |
# File 'lib/stripe/resources/invoice.rb', line 926 def billing_reason @billing_reason end |
#collection_method ⇒ Object (readonly)
Either charge_automatically, or send_invoice. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions.
928 929 930 |
# File 'lib/stripe/resources/invoice.rb', line 928 def collection_method @collection_method end |
#confirmation_secret ⇒ Object (readonly)
The confirmation secret associated with this invoice. Currently, this contains the client_secret of the PaymentIntent that Stripe creates during invoice finalization.
930 931 932 |
# File 'lib/stripe/resources/invoice.rb', line 930 def confirmation_secret @confirmation_secret end |
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
932 933 934 |
# File 'lib/stripe/resources/invoice.rb', line 932 def created @created end |
#currency ⇒ Object (readonly)
Three-letter ISO currency code, in lowercase. Must be a supported currency.
934 935 936 |
# File 'lib/stripe/resources/invoice.rb', line 934 def currency @currency end |
#custom_fields ⇒ Object (readonly)
Custom fields displayed on the invoice.
936 937 938 |
# File 'lib/stripe/resources/invoice.rb', line 936 def custom_fields @custom_fields end |
#customer ⇒ Object (readonly)
The ID of the customer to bill.
938 939 940 |
# File 'lib/stripe/resources/invoice.rb', line 938 def customer @customer end |
#customer_account ⇒ Object (readonly)
The ID of the account representing the customer to bill.
940 941 942 |
# File 'lib/stripe/resources/invoice.rb', line 940 def customer_account @customer_account end |
#customer_address ⇒ Object (readonly)
The customer's address. Until the invoice is finalized, this field will equal customer.address. Once the invoice is finalized, this field will no longer be updated.
942 943 944 |
# File 'lib/stripe/resources/invoice.rb', line 942 def customer_address @customer_address end |
#customer_email ⇒ Object (readonly)
The customer's email. Until the invoice is finalized, this field will equal customer.email. Once the invoice is finalized, this field will no longer be updated.
944 945 946 |
# File 'lib/stripe/resources/invoice.rb', line 944 def customer_email @customer_email end |
#customer_name ⇒ Object (readonly)
The customer's name. Until the invoice is finalized, this field will equal customer.name. Once the invoice is finalized, this field will no longer be updated.
946 947 948 |
# File 'lib/stripe/resources/invoice.rb', line 946 def customer_name @customer_name end |
#customer_phone ⇒ Object (readonly)
The customer's phone number. Until the invoice is finalized, this field will equal customer.phone. Once the invoice is finalized, this field will no longer be updated.
948 949 950 |
# File 'lib/stripe/resources/invoice.rb', line 948 def customer_phone @customer_phone end |
#customer_shipping ⇒ Object (readonly)
The customer's shipping information. Until the invoice is finalized, this field will equal customer.shipping. Once the invoice is finalized, this field will no longer be updated.
950 951 952 |
# File 'lib/stripe/resources/invoice.rb', line 950 def customer_shipping @customer_shipping end |
#customer_tax_exempt ⇒ Object (readonly)
The customer's tax exempt status. Until the invoice is finalized, this field will equal customer.tax_exempt. Once the invoice is finalized, this field will no longer be updated.
952 953 954 |
# File 'lib/stripe/resources/invoice.rb', line 952 def customer_tax_exempt @customer_tax_exempt end |
#customer_tax_ids ⇒ Object (readonly)
The customer's tax IDs. Until the invoice is finalized, this field will contain the same tax IDs as customer.tax_ids. Once the invoice is finalized, this field will no longer be updated.
954 955 956 |
# File 'lib/stripe/resources/invoice.rb', line 954 def customer_tax_ids @customer_tax_ids end |
#default_payment_method ⇒ Object (readonly)
ID of the default payment method for the invoice. It must belong to the customer associated with the invoice. If not set, defaults to the subscription's default payment method, if any, or to the default payment method in the customer's invoice settings.
956 957 958 |
# File 'lib/stripe/resources/invoice.rb', line 956 def default_payment_method @default_payment_method end |
#default_source ⇒ Object (readonly)
ID of the default payment source for the invoice. It must belong to the customer associated with the invoice and be in a chargeable state. If not set, defaults to the subscription's default source, if any, or to the customer's default source.
958 959 960 |
# File 'lib/stripe/resources/invoice.rb', line 958 def default_source @default_source end |
#default_tax_rates ⇒ Object (readonly)
The tax rates applied to this invoice, if any.
960 961 962 |
# File 'lib/stripe/resources/invoice.rb', line 960 def default_tax_rates @default_tax_rates end |
#deleted ⇒ Object (readonly)
Always true for a deleted object
962 963 964 |
# File 'lib/stripe/resources/invoice.rb', line 962 def deleted @deleted end |
#description ⇒ Object (readonly)
An arbitrary string attached to the object. Often useful for displaying to users. Referenced as 'memo' in the Dashboard.
964 965 966 |
# File 'lib/stripe/resources/invoice.rb', line 964 def description @description end |
#discounts ⇒ Object (readonly)
The discounts applied to the invoice. Line item discounts are applied before invoice discounts. Use expand[]=discounts to expand each discount.
966 967 968 |
# File 'lib/stripe/resources/invoice.rb', line 966 def discounts @discounts end |
#due_date ⇒ Object (readonly)
The date on which payment for this invoice is due. This value will be null for invoices where collection_method=charge_automatically.
968 969 970 |
# File 'lib/stripe/resources/invoice.rb', line 968 def due_date @due_date end |
#effective_at ⇒ Object (readonly)
The date when this invoice is in effect. Same as finalized_at unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the invoice PDF and receipt.
970 971 972 |
# File 'lib/stripe/resources/invoice.rb', line 970 def effective_at @effective_at end |
#ending_balance ⇒ Object (readonly)
Ending customer balance after the invoice is finalized. Invoices are finalized approximately an hour after successful webhook delivery or when payment collection is attempted for the invoice. If the invoice has not been finalized yet, this will be null.
972 973 974 |
# File 'lib/stripe/resources/invoice.rb', line 972 def ending_balance @ending_balance end |
#footer ⇒ Object (readonly)
Footer displayed on the invoice.
974 975 976 |
# File 'lib/stripe/resources/invoice.rb', line 974 def @footer end |
#from_invoice ⇒ Object (readonly)
Details of the invoice that was cloned. See the revision documentation for more details.
976 977 978 |
# File 'lib/stripe/resources/invoice.rb', line 976 def from_invoice @from_invoice end |
#hosted_invoice_url ⇒ Object (readonly)
The URL for the hosted invoice page, which allows customers to view and pay an invoice. If the invoice has not been finalized yet, this will be null.
978 979 980 |
# File 'lib/stripe/resources/invoice.rb', line 978 def hosted_invoice_url @hosted_invoice_url end |
#id ⇒ Object (readonly)
Unique identifier for the object. For preview invoices created using the create preview endpoint, this id will be prefixed with upcoming_in.
980 981 982 |
# File 'lib/stripe/resources/invoice.rb', line 980 def id @id end |
#invoice_pdf ⇒ Object (readonly)
The link to download the PDF for the invoice. If the invoice has not been finalized yet, this will be null.
982 983 984 |
# File 'lib/stripe/resources/invoice.rb', line 982 def invoice_pdf @invoice_pdf end |
#issuer ⇒ Object (readonly)
Attribute for field issuer
984 985 986 |
# File 'lib/stripe/resources/invoice.rb', line 984 def issuer @issuer end |
#last_finalization_error ⇒ Object (readonly)
The error encountered during the previous attempt to finalize the invoice. This field is cleared when the invoice is successfully finalized.
986 987 988 |
# File 'lib/stripe/resources/invoice.rb', line 986 def last_finalization_error @last_finalization_error end |
#latest_revision ⇒ Object (readonly)
The ID of the most recent non-draft revision of this invoice
988 989 990 |
# File 'lib/stripe/resources/invoice.rb', line 988 def latest_revision @latest_revision end |
#lines ⇒ Object (readonly)
The individual line items that make up the invoice. lines is sorted as follows: (1) pending invoice items (including prorations) in reverse chronological order, (2) subscription items in reverse chronological order, and (3) invoice items added after invoice creation in chronological order.
990 991 992 |
# File 'lib/stripe/resources/invoice.rb', line 990 def lines @lines end |
#livemode ⇒ Object (readonly)
If the object exists in live mode, the value is true. If the object exists in test mode, the value is false.
992 993 994 |
# File 'lib/stripe/resources/invoice.rb', line 992 def livemode @livemode end |
#metadata ⇒ Object (readonly)
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
994 995 996 |
# File 'lib/stripe/resources/invoice.rb', line 994 def @metadata end |
#next_payment_attempt ⇒ Object (readonly)
The time at which payment will next be attempted. This value will be null for invoices where collection_method=send_invoice.
996 997 998 |
# File 'lib/stripe/resources/invoice.rb', line 996 def next_payment_attempt @next_payment_attempt end |
#number ⇒ Object (readonly)
A unique, identifying string that appears on emails sent to the customer for this invoice. This starts with the customer's unique invoice_prefix if it is specified.
998 999 1000 |
# File 'lib/stripe/resources/invoice.rb', line 998 def number @number end |
#object ⇒ Object (readonly)
String representing the object's type. Objects of the same type share the same value.
1000 1001 1002 |
# File 'lib/stripe/resources/invoice.rb', line 1000 def object @object end |
#on_behalf_of ⇒ Object (readonly)
The account (if any) for which the funds of the invoice payment are intended. If set, the invoice will be presented with the branding and support information of the specified account. See the Invoices with Connect documentation for details.
1002 1003 1004 |
# File 'lib/stripe/resources/invoice.rb', line 1002 def on_behalf_of @on_behalf_of end |
#parent ⇒ Object (readonly)
The parent that generated this invoice
1004 1005 1006 |
# File 'lib/stripe/resources/invoice.rb', line 1004 def parent @parent end |
#payment_settings ⇒ Object (readonly)
Attribute for field payment_settings
1006 1007 1008 |
# File 'lib/stripe/resources/invoice.rb', line 1006 def payment_settings @payment_settings end |
#payments ⇒ Object (readonly)
Payments for this invoice. Use invoice payment to get more details.
1008 1009 1010 |
# File 'lib/stripe/resources/invoice.rb', line 1008 def payments @payments end |
#period_end ⇒ Object (readonly)
The latest timestamp at which invoice items can be associated with this invoice. Use the line item period to get the service period for each price.
1010 1011 1012 |
# File 'lib/stripe/resources/invoice.rb', line 1010 def period_end @period_end end |
#period_start ⇒ Object (readonly)
The earliest timestamp at which invoice items can be associated with this invoice. Use the line item period to get the service period for each price.
1012 1013 1014 |
# File 'lib/stripe/resources/invoice.rb', line 1012 def period_start @period_start end |
#post_payment_credit_notes_amount ⇒ Object (readonly)
Total amount of all post-payment credit notes issued for this invoice.
1014 1015 1016 |
# File 'lib/stripe/resources/invoice.rb', line 1014 def post_payment_credit_notes_amount @post_payment_credit_notes_amount end |
#pre_payment_credit_notes_amount ⇒ Object (readonly)
Total amount of all pre-payment credit notes issued for this invoice.
1016 1017 1018 |
# File 'lib/stripe/resources/invoice.rb', line 1016 def pre_payment_credit_notes_amount @pre_payment_credit_notes_amount end |
#receipt_number ⇒ Object (readonly)
This is the transaction number that appears on email receipts sent for this invoice.
1018 1019 1020 |
# File 'lib/stripe/resources/invoice.rb', line 1018 def receipt_number @receipt_number end |
#rendering ⇒ Object (readonly)
The rendering-related settings that control how the invoice is displayed on customer-facing surfaces such as PDF and Hosted Invoice Page.
1020 1021 1022 |
# File 'lib/stripe/resources/invoice.rb', line 1020 def rendering @rendering end |
#shipping_cost ⇒ Object (readonly)
The details of the cost of shipping, including the ShippingRate applied on the invoice.
1022 1023 1024 |
# File 'lib/stripe/resources/invoice.rb', line 1022 def shipping_cost @shipping_cost end |
#shipping_details ⇒ Object (readonly)
Shipping details for the invoice. The Invoice PDF will use the shipping_details value if it is set, otherwise the PDF will render the shipping address from the customer.
1024 1025 1026 |
# File 'lib/stripe/resources/invoice.rb', line 1024 def shipping_details @shipping_details end |
#starting_balance ⇒ Object (readonly)
Starting customer balance before the invoice is finalized. If the invoice has not been finalized yet, this will be the current customer balance. For revision invoices, this also includes any customer balance that was applied to the original invoice.
1026 1027 1028 |
# File 'lib/stripe/resources/invoice.rb', line 1026 def starting_balance @starting_balance end |
#statement_descriptor ⇒ Object (readonly)
Extra information about an invoice for the customer's credit card statement.
1028 1029 1030 |
# File 'lib/stripe/resources/invoice.rb', line 1028 def statement_descriptor @statement_descriptor end |
#status ⇒ Object (readonly)
The status of the invoice, one of draft, open, paid, uncollectible, or void. Learn more
1030 1031 1032 |
# File 'lib/stripe/resources/invoice.rb', line 1030 def status @status end |
#status_transitions ⇒ Object (readonly)
Attribute for field status_transitions
1032 1033 1034 |
# File 'lib/stripe/resources/invoice.rb', line 1032 def status_transitions @status_transitions end |
#subtotal ⇒ Object (readonly)
Total of all subscriptions, invoice items, and prorations on the invoice before any invoice level discount or exclusive tax is applied. Item discounts are already incorporated
1034 1035 1036 |
# File 'lib/stripe/resources/invoice.rb', line 1034 def subtotal @subtotal end |
#subtotal_excluding_tax ⇒ Object (readonly)
The integer amount in cents (or local equivalent) representing the subtotal of the invoice before any invoice level discount or tax is applied. Item discounts are already incorporated
1036 1037 1038 |
# File 'lib/stripe/resources/invoice.rb', line 1036 def subtotal_excluding_tax @subtotal_excluding_tax end |
#test_clock ⇒ Object (readonly)
ID of the test clock this invoice belongs to.
1038 1039 1040 |
# File 'lib/stripe/resources/invoice.rb', line 1038 def test_clock @test_clock end |
#threshold_reason ⇒ Object (readonly)
Attribute for field threshold_reason
1040 1041 1042 |
# File 'lib/stripe/resources/invoice.rb', line 1040 def threshold_reason @threshold_reason end |
#total ⇒ Object (readonly)
Total after discounts and taxes.
1042 1043 1044 |
# File 'lib/stripe/resources/invoice.rb', line 1042 def total @total end |
#total_discount_amounts ⇒ Object (readonly)
The aggregate amounts calculated per discount across all line items.
1044 1045 1046 |
# File 'lib/stripe/resources/invoice.rb', line 1044 def total_discount_amounts @total_discount_amounts end |
#total_excluding_tax ⇒ Object (readonly)
The integer amount in cents (or local equivalent) representing the total amount of the invoice including all discounts but excluding all tax.
1046 1047 1048 |
# File 'lib/stripe/resources/invoice.rb', line 1046 def total_excluding_tax @total_excluding_tax end |
#total_pretax_credit_amounts ⇒ Object (readonly)
Contains pretax credit amounts (ex: discount, credit grants, etc) that apply to this invoice. This is a combined list of total_pretax_credit_amounts across all invoice line items.
1048 1049 1050 |
# File 'lib/stripe/resources/invoice.rb', line 1048 def total_pretax_credit_amounts @total_pretax_credit_amounts end |
#total_taxes ⇒ Object (readonly)
The aggregate tax information of all line items.
1050 1051 1052 |
# File 'lib/stripe/resources/invoice.rb', line 1050 def total_taxes @total_taxes end |
#webhooks_delivered_at ⇒ Object (readonly)
Invoices are automatically paid or sent 1 hour after webhooks are delivered, or until all webhook delivery attempts have been exhausted. This field tracks the time when webhooks for this invoice were successfully delivered. If the invoice had no webhooks to deliver, this will be set while the invoice is being created.
1052 1053 1054 |
# File 'lib/stripe/resources/invoice.rb', line 1052 def webhooks_delivered_at @webhooks_delivered_at end |
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.
1065 1066 1067 1068 1069 1070 1071 1072 |
# File 'lib/stripe/resources/invoice.rb', line 1065 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 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: Partial payments to learn more.
1103 1104 1105 1106 1107 1108 1109 1110 |
# File 'lib/stripe/resources/invoice.rb', line 1103 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 |
.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 or send](https://docs.stripe.com/api/invoices/finalize) the invoice to your customers.
1113 1114 1115 |
# File 'lib/stripe/resources/invoice.rb', line 1113 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 subscription or subscription schedule. 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.
You can also preview the effects of creating or updating a subscription or subscription schedule, including a preview of any prorations that 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 on the invoice is to consider line items where parent.subscription_item_details.proration is true.
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.
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
1126 1127 1128 1129 1130 1131 1132 1133 |
# File 'lib/stripe/resources/invoice.rb', line 1126 def self.create_preview(params = {}, opts = {}) request_stripe_object( method: :post, path: "/v1/invoices/create_preview", params: params, opts: opts ) end |
.delete(invoice, 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.
1136 1137 1138 1139 1140 1141 1142 1143 |
# File 'lib/stripe/resources/invoice.rb', line 1136 def self.delete(invoice, params = {}, opts = {}) request_stripe_object( method: :delete, path: format("/v1/invoices/%<invoice>s", { invoice: CGI.escape(invoice) }), params: params, opts: opts ) end |
.field_remappings ⇒ Object
1355 1356 1357 |
# File 'lib/stripe/resources/invoice.rb', line 1355 def self.field_remappings @field_remappings = {} 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.
1166 1167 1168 1169 1170 1171 1172 1173 |
# File 'lib/stripe/resources/invoice.rb', line 1166 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 |
.inner_class_types ⇒ Object
1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 |
# File 'lib/stripe/resources/invoice.rb', line 1331 def self.inner_class_types @inner_class_types = { automatic_tax: AutomaticTax, confirmation_secret: ConfirmationSecret, custom_fields: CustomField, customer_address: CustomerAddress, customer_shipping: CustomerShipping, customer_tax_ids: CustomerTaxId, from_invoice: FromInvoice, issuer: Issuer, last_finalization_error: LastFinalizationError, parent: Parent, payment_settings: PaymentSettings, rendering: Rendering, shipping_cost: ShippingCost, shipping_details: ShippingDetails, status_transitions: StatusTransitions, threshold_reason: ThresholdReason, total_discount_amounts: TotalDiscountAmount, total_pretax_credit_amounts: TotalPretaxCreditAmount, total_taxes: TotalTax, } end |
.list(params = {}, 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.
1176 1177 1178 |
# File 'lib/stripe/resources/invoice.rb', line 1176 def self.list(params = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/invoices", 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.
1191 1192 1193 1194 1195 1196 1197 1198 |
# File 'lib/stripe/resources/invoice.rb', line 1191 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. 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.
1211 1212 1213 1214 1215 1216 1217 1218 |
# File 'lib/stripe/resources/invoice.rb', line 1211 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.
1231 1232 1233 1234 1235 1236 1237 1238 |
# File 'lib/stripe/resources/invoice.rb', line 1231 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
1240 1241 1242 |
# File 'lib/stripe/resources/invoice.rb', line 1240 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
1244 1245 1246 |
# File 'lib/stripe/resources/invoice.rb', line 1244 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. 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.
1263 1264 1265 1266 1267 1268 1269 1270 |
# File 'lib/stripe/resources/invoice.rb', line 1263 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 |
.update(invoice, params = {}, opts = {}) ⇒ Object
Draft invoices are fully editable. Once an invoice is 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 invoices, pass auto_advance=false.
1278 1279 1280 1281 1282 1283 1284 1285 |
# File 'lib/stripe/resources/invoice.rb', line 1278 def self.update(invoice, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/invoices/%<invoice>s", { invoice: CGI.escape(invoice) }), 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.
1298 1299 1300 1301 1302 1303 1304 1305 |
# File 'lib/stripe/resources/invoice.rb', line 1298 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, 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 credit note](https://docs.stripe.com/api/invoices/create) instead. Stripe recommends that you consult with your legal counsel for advice specific to your business.
1322 1323 1324 1325 1326 1327 1328 1329 |
# File 'lib/stripe/resources/invoice.rb', line 1322 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.
1055 1056 1057 1058 1059 1060 1061 1062 |
# File 'lib/stripe/resources/invoice.rb', line 1055 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 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: Partial payments to learn more.
1084 1085 1086 1087 1088 1089 1090 1091 |
# File 'lib/stripe/resources/invoice.rb', line 1084 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 |
#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.
1146 1147 1148 1149 1150 1151 1152 1153 |
# File 'lib/stripe/resources/invoice.rb', line 1146 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.
1156 1157 1158 1159 1160 1161 1162 1163 |
# File 'lib/stripe/resources/invoice.rb', line 1156 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.
1181 1182 1183 1184 1185 1186 1187 1188 |
# File 'lib/stripe/resources/invoice.rb', line 1181 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. 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.
1201 1202 1203 1204 1205 1206 1207 1208 |
# File 'lib/stripe/resources/invoice.rb', line 1201 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.
1221 1222 1223 1224 1225 1226 1227 1228 |
# File 'lib/stripe/resources/invoice.rb', line 1221 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. 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.
1251 1252 1253 1254 1255 1256 1257 1258 |
# File 'lib/stripe/resources/invoice.rb', line 1251 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.
1288 1289 1290 1291 1292 1293 1294 1295 |
# File 'lib/stripe/resources/invoice.rb', line 1288 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, 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 credit note](https://docs.stripe.com/api/invoices/create) instead. Stripe recommends that you consult with your legal counsel for advice specific to your business.
1310 1311 1312 1313 1314 1315 1316 1317 |
# File 'lib/stripe/resources/invoice.rb', line 1310 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 |