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)
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.
- .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?, #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.
21 22 23 |
# File 'lib/stripe/resources/topup.rb', line 21 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.
23 24 25 |
# File 'lib/stripe/resources/topup.rb', line 23 def balance_transaction @balance_transaction end |
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
25 26 27 |
# File 'lib/stripe/resources/topup.rb', line 25 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).
27 28 29 |
# File 'lib/stripe/resources/topup.rb', line 27 def currency @currency end |
#description ⇒ Object (readonly)
An arbitrary string attached to the object. Often useful for displaying to users.
29 30 31 |
# File 'lib/stripe/resources/topup.rb', line 29 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.
31 32 33 |
# File 'lib/stripe/resources/topup.rb', line 31 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).
33 34 35 |
# File 'lib/stripe/resources/topup.rb', line 33 def failure_code @failure_code end |
#failure_message ⇒ Object (readonly)
Message to user further explaining reason for top-up failure if available.
35 36 37 |
# File 'lib/stripe/resources/topup.rb', line 35 def end |
#id ⇒ Object (readonly)
Unique identifier for the object.
37 38 39 |
# File 'lib/stripe/resources/topup.rb', line 37 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.
39 40 41 |
# File 'lib/stripe/resources/topup.rb', line 39 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.
41 42 43 |
# File 'lib/stripe/resources/topup.rb', line 41 def end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
43 44 45 |
# File 'lib/stripe/resources/topup.rb', line 43 def object @object end |
#source ⇒ Object (readonly)
The source field is deprecated. It might not always be present in the API response.
45 46 47 |
# File 'lib/stripe/resources/topup.rb', line 45 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.
47 48 49 |
# File 'lib/stripe/resources/topup.rb', line 47 def statement_descriptor @statement_descriptor end |
#status ⇒ Object (readonly)
The status of the top-up is either ‘canceled`, `failed`, `pending`, `reversed`, or `succeeded`.
49 50 51 |
# File 'lib/stripe/resources/topup.rb', line 49 def status @status end |
#transfer_group ⇒ Object (readonly)
A string that identifies this top-up as part of a group.
51 52 53 |
# File 'lib/stripe/resources/topup.rb', line 51 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.
64 65 66 67 68 69 70 71 |
# File 'lib/stripe/resources/topup.rb', line 64 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
74 75 76 |
# File 'lib/stripe/resources/topup.rb', line 74 def self.create(params = {}, opts = {}) request_stripe_object(method: :post, path: "/v1/topups", params: params, opts: opts) end |
.field_remappings ⇒ Object
97 98 99 |
# File 'lib/stripe/resources/topup.rb', line 97 def self.field_remappings @field_remappings = {} end |
.inner_class_types ⇒ Object
93 94 95 |
# File 'lib/stripe/resources/topup.rb', line 93 def self.inner_class_types @inner_class_types = {} end |
.list(params = {}, opts = {}) ⇒ Object
Returns a list of top-ups.
79 80 81 |
# File 'lib/stripe/resources/topup.rb', line 79 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.
84 85 86 87 88 89 90 91 |
# File 'lib/stripe/resources/topup.rb', line 84 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.
54 55 56 57 58 59 60 61 |
# File 'lib/stripe/resources/topup.rb', line 54 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 |