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.



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

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



181
182
183
# File 'lib/stripe/services/topup_service.rb', line 181

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.



186
187
188
# File 'lib/stripe/services/topup_service.rb', line 186

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.



191
192
193
194
195
196
197
198
199
# File 'lib/stripe/services/topup_service.rb', line 191

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.



202
203
204
205
206
207
208
209
210
# File 'lib/stripe/services/topup_service.rb', line 202

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