Class: Stripe::InvoicePayment

Inherits:
APIResource show all
Extended by:
APIOperations::List
Defined in:
lib/stripe/resources/invoice_payment.rb

Overview

Invoice Payments represent payments made against invoices. Invoice Payments can be accessed in two ways:

  1. By expanding the ‘payments` field on the [Invoice](stripe.com/docs/api#invoice) resource.

  2. By using the Invoice Payment retrieve and list endpoints.

Invoice Payments include the mapping between payment objects, such as Payment Intent, and Invoices. This resource and its endpoints allows you to easily track if a payment is associated with a specific invoice and monitor the allocation details of the payments.

Defined Under Namespace

Classes: Payment, StatusTransitions

Constant Summary collapse

OBJECT_NAME =
"invoice_payment"

Constants inherited from StripeObject

StripeObject::RESERVED_FIELD_NAMES

Instance Attribute Summary collapse

Attributes inherited from APIResource

#save_with_parent

Attributes inherited from StripeObject

#last_response

Class Method Summary collapse

Methods included from APIOperations::List

list

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

included

Methods inherited from StripeObject

#==, #[], #[]=, #_get_inner_class_type, 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

Instance Attribute Details

#amount_paidObject (readonly)

Amount that was actually paid for this invoice, in cents (or local equivalent). This field is null until the payment is ‘paid`. This amount can be less than the `amount_requested` if the PaymentIntent’s `amount_received` is not sufficient to pay all of the invoices that it is attached to.



55
56
57
# File 'lib/stripe/resources/invoice_payment.rb', line 55

def amount_paid
  @amount_paid
end

#amount_requestedObject (readonly)

Amount intended to be paid toward this invoice, in cents (or local equivalent)



57
58
59
# File 'lib/stripe/resources/invoice_payment.rb', line 57

def amount_requested
  @amount_requested
end

#createdObject (readonly)

Time at which the object was created. Measured in seconds since the Unix epoch.



59
60
61
# File 'lib/stripe/resources/invoice_payment.rb', line 59

def created
  @created
end

#currencyObject (readonly)

Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](stripe.com/docs/currencies).



61
62
63
# File 'lib/stripe/resources/invoice_payment.rb', line 61

def currency
  @currency
end

#idObject (readonly)

Unique identifier for the object.



63
64
65
# File 'lib/stripe/resources/invoice_payment.rb', line 63

def id
  @id
end

#invoiceObject (readonly)

The invoice that was paid.



65
66
67
# File 'lib/stripe/resources/invoice_payment.rb', line 65

def invoice
  @invoice
end

#is_defaultObject (readonly)

Stripe automatically creates a default InvoicePayment when the invoice is finalized, and keeps it synchronized with the invoice’s ‘amount_remaining`. The PaymentIntent associated with the default payment can’t be edited or canceled directly.



67
68
69
# File 'lib/stripe/resources/invoice_payment.rb', line 67

def is_default
  @is_default
end

#livemodeObject (readonly)

Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.



69
70
71
# File 'lib/stripe/resources/invoice_payment.rb', line 69

def livemode
  @livemode
end

#objectObject (readonly)

String representing the object’s type. Objects of the same type share the same value.



71
72
73
# File 'lib/stripe/resources/invoice_payment.rb', line 71

def object
  @object
end

#paymentObject (readonly)

Attribute for field payment



73
74
75
# File 'lib/stripe/resources/invoice_payment.rb', line 73

def payment
  @payment
end

#statusObject (readonly)

The status of the payment, one of ‘open`, `paid`, or `canceled`.



75
76
77
# File 'lib/stripe/resources/invoice_payment.rb', line 75

def status
  @status
end

#status_transitionsObject (readonly)

Attribute for field status_transitions



77
78
79
# File 'lib/stripe/resources/invoice_payment.rb', line 77

def status_transitions
  @status_transitions
end

Class Method Details

.field_remappingsObject



88
89
90
# File 'lib/stripe/resources/invoice_payment.rb', line 88

def self.field_remappings
  @field_remappings = {}
end

.inner_class_typesObject



84
85
86
# File 'lib/stripe/resources/invoice_payment.rb', line 84

def self.inner_class_types
  @inner_class_types = { payment: Payment, status_transitions: StatusTransitions }
end

.list(params = {}, opts = {}) ⇒ Object

When retrieving an invoice, there is an includable payments property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of payments.



80
81
82
# File 'lib/stripe/resources/invoice_payment.rb', line 80

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

.object_nameObject



17
18
19
# File 'lib/stripe/resources/invoice_payment.rb', line 17

def self.object_name
  "invoice_payment"
end