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](stripe.com/docs/connect/top-ups)
Defined Under Namespace
Classes: CancelParams, CreateParams, ListParams, RetrieveParams, UpdateParams
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](www.iso.org/iso-4217-currency-codes.html), 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](stripe.com/docs/api#errors) 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.
-
#livemode ⇒ Object
readonly
Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.
-
#metadata ⇒ Object
readonly
Set of [key-value pairs](stripe.com/docs/api/metadata) that you can attach to an object.
-
#object ⇒ Object
readonly
String representing the object’s type.
-
#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`, or `succeeded`.
-
#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.
-
.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
#==, #[], #[]=, 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 ⇒ Object (readonly)
Amount transferred.
162 163 164 |
# File 'lib/stripe/resources/topup.rb', line 162 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.
164 165 166 |
# File 'lib/stripe/resources/topup.rb', line 164 def balance_transaction @balance_transaction end |
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
166 167 168 |
# File 'lib/stripe/resources/topup.rb', line 166 def created @created end |
#currency ⇒ Object (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).
168 169 170 |
# File 'lib/stripe/resources/topup.rb', line 168 def currency @currency end |
#description ⇒ Object (readonly)
An arbitrary string attached to the object. Often useful for displaying to users.
170 171 172 |
# File 'lib/stripe/resources/topup.rb', line 170 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.
172 173 174 |
# File 'lib/stripe/resources/topup.rb', line 172 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](stripe.com/docs/api#errors) for a list of codes).
174 175 176 |
# File 'lib/stripe/resources/topup.rb', line 174 def failure_code @failure_code end |
#failure_message ⇒ Object (readonly)
Message to user further explaining reason for top-up failure if available.
176 177 178 |
# File 'lib/stripe/resources/topup.rb', line 176 def @failure_message end |
#id ⇒ Object (readonly)
Unique identifier for the object.
178 179 180 |
# File 'lib/stripe/resources/topup.rb', line 178 def id @id end |
#livemode ⇒ Object (readonly)
Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.
180 181 182 |
# File 'lib/stripe/resources/topup.rb', line 180 def livemode @livemode end |
#metadata ⇒ Object (readonly)
Set of [key-value pairs](stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
182 183 184 |
# File 'lib/stripe/resources/topup.rb', line 182 def @metadata end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
184 185 186 |
# File 'lib/stripe/resources/topup.rb', line 184 def object @object end |
#source ⇒ Object (readonly)
The source field is deprecated. It might not always be present in the API response.
186 187 188 |
# File 'lib/stripe/resources/topup.rb', line 186 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.
188 189 190 |
# File 'lib/stripe/resources/topup.rb', line 188 def statement_descriptor @statement_descriptor end |
#status ⇒ Object (readonly)
The status of the top-up is either ‘canceled`, `failed`, `pending`, `reversed`, or `succeeded`.
190 191 192 |
# File 'lib/stripe/resources/topup.rb', line 190 def status @status end |
#transfer_group ⇒ Object (readonly)
A string that identifies this top-up as part of a group.
192 193 194 |
# File 'lib/stripe/resources/topup.rb', line 192 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.
205 206 207 208 209 210 211 212 |
# File 'lib/stripe/resources/topup.rb', line 205 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
215 216 217 |
# File 'lib/stripe/resources/topup.rb', line 215 def self.create(params = {}, opts = {}) request_stripe_object(method: :post, path: "/v1/topups", params: params, opts: opts) end |
.list(params = {}, opts = {}) ⇒ Object
Returns a list of top-ups.
220 221 222 |
# File 'lib/stripe/resources/topup.rb', line 220 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.
225 226 227 228 229 230 231 232 |
# File 'lib/stripe/resources/topup.rb', line 225 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.
195 196 197 198 199 200 201 202 |
# File 'lib/stripe/resources/topup.rb', line 195 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 |