Class: Stripe::V2::Core::Accounts::PersonTokenService

Inherits:
StripeService
  • Object
show all
Defined in:
lib/stripe/services/v2/core/accounts/person_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(account_id, params = {}, opts = {}) ⇒ Object

Creates a single-use token that represents the details for a person. Use this when you create or update persons associated with an Account v2. Learn more about account tokens. You can only create person tokens with your application's publishable key and in live mode. You can use your application's secret key to create person tokens only in test mode.

** raises RateLimitError



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/stripe/services/v2/core/accounts/person_token_service.rb', line 13

def create(, params = {}, opts = {})
  unless params.is_a?(Stripe::RequestParams)
    params = ::Stripe::V2::Core::Accounts::PersonTokenCreateParams.coerce_params(params)
  end

  request(
    method: :post,
    path: format("/v2/core/accounts/%<account_id>s/person_tokens", { account_id: CGI.escape() }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

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

Retrieves a Person Token associated with an Account.

** raises RateLimitError



30
31
32
33
34
35
36
37
38
# File 'lib/stripe/services/v2/core/accounts/person_token_service.rb', line 30

def retrieve(, id, params = {}, opts = {})
  request(
    method: :get,
    path: format("/v2/core/accounts/%<account_id>s/person_tokens/%<id>s", { account_id: CGI.escape(), id: CGI.escape(id) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end