Class: Stripe::Topup
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::Topup
- Extended by:
- APIOperations::Create, APIOperations::List
- Includes:
- APIOperations::Save
- Defined in:
- lib/stripe/resources/topup.rb
Overview
To top up your Stripe balance, you create a top-up object. You can retrieve individual top-ups, as well as list all top-ups. Top-ups are identified by a unique, random ID.
Related guide: Topping up your platform account
Defined Under Namespace
Classes: PaymentMethodOptions
Constant Summary collapse
- OBJECT_NAME =
"topup"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Amount transferred.
-
#balance_transaction ⇒ Object
readonly
ID of the balance transaction that describes the impact of this top-up on your account balance.
-
#created ⇒ Object
readonly
Time at which the object was created.
-
#currency ⇒ Object
readonly
Three-letter ISO currency code, in lowercase.
-
#description ⇒ Object
readonly
An arbitrary string attached to the object.
-
#expected_availability_date ⇒ Object
readonly
Date the funds are expected to arrive in your Stripe account for payouts.
-
#failure_code ⇒ Object
readonly
Error code explaining reason for top-up failure if available (see the errors section for a list of codes).
-
#failure_message ⇒ Object
readonly
Message to user further explaining reason for top-up failure if available.
-
#id ⇒ Object
readonly
Unique identifier for the object.
-
#initiated_by ⇒ Object
readonly
Indicates whether the top-up was initiated by Stripe or by the user.
-
#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.
-
#object ⇒ Object
readonly
String representing the object's type.
-
#payment_method ⇒ Object
readonly
The ID of a PaymentMethod representing the payment method used for the top-up.
-
#payment_method_options ⇒ Object
readonly
Payment-method-specific configuration for this top-up.
-
#source ⇒ Object
readonly
The source field is deprecated.
-
#statement_descriptor ⇒ Object
readonly
Extra information about a top-up.
-
#status ⇒ Object
readonly
The status of the top-up is either
canceled,failed,pending,reversed, orsucceeded. -
#transfer_group ⇒ Object
readonly
A string that identifies this top-up as part of a group.
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
-
.cancel(topup, params = {}, opts = {}) ⇒ Object
Cancels a top-up.
-
.create(params = {}, opts = {}) ⇒ Object
Top up the balance of an account.
- .field_remappings ⇒ Object
- .inner_class_types ⇒ Object
-
.list(params = {}, opts = {}) ⇒ Object
Returns a list of top-ups.
- .object_name ⇒ Object
-
.update(topup, params = {}, opts = {}) ⇒ Object
Updates the metadata of a top-up.
Instance Method Summary collapse
-
#cancel(params = {}, opts = {}) ⇒ Object
Cancels a top-up.
Methods included from APIOperations::Create
Methods included from APIOperations::List
Methods included from APIOperations::Save
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
#amount ⇒ Object (readonly)
Amount transferred.
45 46 47 |
# File 'lib/stripe/resources/topup.rb', line 45 def amount @amount end |
#balance_transaction ⇒ Object (readonly)
ID of the balance transaction that describes the impact of this top-up on your account balance. May not be specified depending on status of top-up.
47 48 49 |
# File 'lib/stripe/resources/topup.rb', line 47 def balance_transaction @balance_transaction end |
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
49 50 51 |
# File 'lib/stripe/resources/topup.rb', line 49 def created @created end |
#currency ⇒ Object (readonly)
Three-letter ISO currency code, in lowercase. Must be a supported currency.
51 52 53 |
# File 'lib/stripe/resources/topup.rb', line 51 def currency @currency end |
#description ⇒ Object (readonly)
An arbitrary string attached to the object. Often useful for displaying to users.
53 54 55 |
# File 'lib/stripe/resources/topup.rb', line 53 def description @description end |
#expected_availability_date ⇒ Object (readonly)
Date the funds are expected to arrive in your Stripe account for payouts. This factors in delays like weekends or bank holidays. May not be specified depending on status of top-up.
55 56 57 |
# File 'lib/stripe/resources/topup.rb', line 55 def expected_availability_date @expected_availability_date end |
#failure_code ⇒ Object (readonly)
Error code explaining reason for top-up failure if available (see the errors section for a list of codes).
57 58 59 |
# File 'lib/stripe/resources/topup.rb', line 57 def failure_code @failure_code end |
#failure_message ⇒ Object (readonly)
Message to user further explaining reason for top-up failure if available.
59 60 61 |
# File 'lib/stripe/resources/topup.rb', line 59 def @failure_message end |
#id ⇒ Object (readonly)
Unique identifier for the object.
61 62 63 |
# File 'lib/stripe/resources/topup.rb', line 61 def id @id end |
#initiated_by ⇒ Object (readonly)
Indicates whether the top-up was initiated by Stripe or by the user.
63 64 65 |
# File 'lib/stripe/resources/topup.rb', line 63 def initiated_by @initiated_by 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.
65 66 67 |
# File 'lib/stripe/resources/topup.rb', line 65 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.
67 68 69 |
# File 'lib/stripe/resources/topup.rb', line 67 def @metadata end |
#object ⇒ Object (readonly)
String representing the object's type. Objects of the same type share the same value.
69 70 71 |
# File 'lib/stripe/resources/topup.rb', line 69 def object @object end |
#payment_method ⇒ Object (readonly)
The ID of a PaymentMethod representing the payment method used for the top-up. A PaymentMethod of type us_bank_account can be used.
71 72 73 |
# File 'lib/stripe/resources/topup.rb', line 71 def payment_method @payment_method end |
#payment_method_options ⇒ Object (readonly)
Payment-method-specific configuration for this top-up.
73 74 75 |
# File 'lib/stripe/resources/topup.rb', line 73 def @payment_method_options end |
#source ⇒ Object (readonly)
The source field is deprecated. It might not always be present in the API response.
75 76 77 |
# File 'lib/stripe/resources/topup.rb', line 75 def source @source end |
#statement_descriptor ⇒ Object (readonly)
Extra information about a top-up. This will appear on your source's bank statement. It must contain at least one letter.
77 78 79 |
# File 'lib/stripe/resources/topup.rb', line 77 def statement_descriptor @statement_descriptor end |
#status ⇒ Object (readonly)
The status of the top-up is either canceled, failed, pending, reversed, or succeeded.
79 80 81 |
# File 'lib/stripe/resources/topup.rb', line 79 def status @status end |
#transfer_group ⇒ Object (readonly)
A string that identifies this top-up as part of a group.
81 82 83 |
# File 'lib/stripe/resources/topup.rb', line 81 def transfer_group @transfer_group end |
Class Method Details
.cancel(topup, params = {}, opts = {}) ⇒ Object
Cancels a top-up. Only pending top-ups can be canceled.
94 95 96 97 98 99 100 101 |
# File 'lib/stripe/resources/topup.rb', line 94 def self.cancel(topup, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/topups/%<topup>s/cancel", { topup: CGI.escape(topup) }), params: params, opts: opts ) end |
.create(params = {}, opts = {}) ⇒ Object
Top up the balance of an account
104 105 106 |
# File 'lib/stripe/resources/topup.rb', line 104 def self.create(params = {}, opts = {}) request_stripe_object(method: :post, path: "/v1/topups", params: params, opts: opts) end |
.field_remappings ⇒ Object
127 128 129 |
# File 'lib/stripe/resources/topup.rb', line 127 def self.field_remappings @field_remappings = {} end |
.inner_class_types ⇒ Object
123 124 125 |
# File 'lib/stripe/resources/topup.rb', line 123 def self.inner_class_types @inner_class_types = { payment_method_options: PaymentMethodOptions } end |
.list(params = {}, opts = {}) ⇒ Object
Returns a list of top-ups.
109 110 111 |
# File 'lib/stripe/resources/topup.rb', line 109 def self.list(params = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/topups", params: params, opts: opts) end |
.object_name ⇒ Object
16 17 18 |
# File 'lib/stripe/resources/topup.rb', line 16 def self.object_name "topup" end |
.update(topup, params = {}, opts = {}) ⇒ Object
Updates the metadata of a top-up. Other top-up details are not editable by design.
114 115 116 117 118 119 120 121 |
# File 'lib/stripe/resources/topup.rb', line 114 def self.update(topup, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/topups/%<topup>s", { topup: CGI.escape(topup) }), params: params, opts: opts ) end |
Instance Method Details
#cancel(params = {}, opts = {}) ⇒ Object
Cancels a top-up. Only pending top-ups can be canceled.
84 85 86 87 88 89 90 91 |
# File 'lib/stripe/resources/topup.rb', line 84 def cancel(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/topups/%<topup>s/cancel", { topup: CGI.escape(self["id"]) }), params: params, opts: opts ) end |