Class: Stripe::TokenService

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

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

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

Creates a single-use token that represents a bank account’s details. You can use this token with any v1 API method in place of a bank account dictionary. You can only use this token once. To do so, attach it to a [connected account](stripe.com/docs/api#accounts) where [controller.requirement_collection](stripe.com/api/accounts/object#account_object-controller-requirement_collection) is application, which includes Custom accounts.



8
9
10
# File 'lib/stripe/services/token_service.rb', line 8

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

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

Retrieves the token with the given ID.



13
14
15
16
17
18
19
20
21
# File 'lib/stripe/services/token_service.rb', line 13

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