Class: Stripe::TopupService

Inherits:
StripeService show all
Defined in:
lib/stripe/services/topup_service.rb

Defined Under Namespace

Classes: CancelParams, CreateParams, ListParams, RetrieveParams, UpdateParams

Instance Method Summary collapse

Methods inherited from StripeService

#initialize, #request, #request_stream

Constructor Details

This class inherits a constructor from Stripe::StripeService

Instance Method Details

#cancel(topup, params = {}, opts = {}) ⇒ Object

Cancels a top-up. Only pending top-ups can be canceled.



149
150
151
152
153
154
155
156
157
# File 'lib/stripe/services/topup_service.rb', line 149

def cancel(topup, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/topups/%<topup>s/cancel", { topup: CGI.escape(topup) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#create(params = {}, opts = {}) ⇒ Object

Top up the balance of an account



160
161
162
# File 'lib/stripe/services/topup_service.rb', line 160

def create(params = {}, opts = {})
  request(method: :post, path: "/v1/topups", params: params, opts: opts, base_address: :api)
end

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

Returns a list of top-ups.



165
166
167
# File 'lib/stripe/services/topup_service.rb', line 165

def list(params = {}, opts = {})
  request(method: :get, path: "/v1/topups", params: params, opts: opts, base_address: :api)
end

#retrieve(topup, params = {}, opts = {}) ⇒ Object

Retrieves the details of a top-up that has previously been created. Supply the unique top-up ID that was returned from your previous request, and Stripe will return the corresponding top-up information.



170
171
172
173
174
175
176
177
178
# File 'lib/stripe/services/topup_service.rb', line 170

def retrieve(topup, params = {}, opts = {})
  request(
    method: :get,
    path: format("/v1/topups/%<topup>s", { topup: CGI.escape(topup) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#update(topup, params = {}, opts = {}) ⇒ Object

Updates the metadata of a top-up. Other top-up details are not editable by design.



181
182
183
184
185
186
187
188
189
# File 'lib/stripe/services/topup_service.rb', line 181

def update(topup, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/topups/%<topup>s", { topup: CGI.escape(topup) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end