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(id, 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.
183 184 185 |
# File 'lib/stripe/resources/topup.rb', line 183 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.
186 187 188 |
# File 'lib/stripe/resources/topup.rb', line 186 def balance_transaction @balance_transaction end |
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
189 190 191 |
# File 'lib/stripe/resources/topup.rb', line 189 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).
192 193 194 |
# File 'lib/stripe/resources/topup.rb', line 192 def currency @currency end |
#description ⇒ Object (readonly)
An arbitrary string attached to the object. Often useful for displaying to users.
195 196 197 |
# File 'lib/stripe/resources/topup.rb', line 195 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.
198 199 200 |
# File 'lib/stripe/resources/topup.rb', line 198 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).
201 202 203 |
# File 'lib/stripe/resources/topup.rb', line 201 def failure_code @failure_code end |
#failure_message ⇒ Object (readonly)
Message to user further explaining reason for top-up failure if available.
204 205 206 |
# File 'lib/stripe/resources/topup.rb', line 204 def @failure_message end |
#id ⇒ Object (readonly)
Unique identifier for the object.
207 208 209 |
# File 'lib/stripe/resources/topup.rb', line 207 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.
210 211 212 |
# File 'lib/stripe/resources/topup.rb', line 210 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.
213 214 215 |
# File 'lib/stripe/resources/topup.rb', line 213 def @metadata end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
216 217 218 |
# File 'lib/stripe/resources/topup.rb', line 216 def object @object end |
#source ⇒ Object (readonly)
The source field is deprecated. It might not always be present in the API response.
219 220 221 |
# File 'lib/stripe/resources/topup.rb', line 219 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.
222 223 224 |
# File 'lib/stripe/resources/topup.rb', line 222 def statement_descriptor @statement_descriptor end |
#status ⇒ Object (readonly)
The status of the top-up is either ‘canceled`, `failed`, `pending`, `reversed`, or `succeeded`.
225 226 227 |
# File 'lib/stripe/resources/topup.rb', line 225 def status @status end |
#transfer_group ⇒ Object (readonly)
A string that identifies this top-up as part of a group.
228 229 230 |
# File 'lib/stripe/resources/topup.rb', line 228 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.
241 242 243 244 245 246 247 248 |
# File 'lib/stripe/resources/topup.rb', line 241 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
251 252 253 |
# File 'lib/stripe/resources/topup.rb', line 251 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.
256 257 258 |
# File 'lib/stripe/resources/topup.rb', line 256 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(id, params = {}, opts = {}) ⇒ Object
Updates the metadata of a top-up. Other top-up details are not editable by design.
261 262 263 264 265 266 267 268 |
# File 'lib/stripe/resources/topup.rb', line 261 def self.update(id, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/topups/%<id>s", { id: CGI.escape(id) }), params: params, opts: opts ) end |
Instance Method Details
#cancel(params = {}, opts = {}) ⇒ Object
Cancels a top-up. Only pending top-ups can be canceled.
231 232 233 234 235 236 237 238 |
# File 'lib/stripe/resources/topup.rb', line 231 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 |