Class used to call the generic ProcessorToken sub-product.

Sections
Methods
C
Public
Instance Public methods
create(access_token, account_id, processor)

Creates a processor token from an access_token.

Does a POST /processor/token/create call which can be used to generate any non-stripe processor token for a given account ID. If the processor is Stripe, the stripe endpoint will be called instead.

access_token

access_token to create a public token for.

account_id

ID of the account to create a processor token for.

processor

name of the processor to create a token for.

Returns

Returns a ProcessorTokenResponse object containing a processor token.

# File lib/plaid/products/processor.rb, line 143
def create(access_token, account_id, processor)
  endpoint = 'processor/token/create'
  options = {
    access_token: access_token,
    account_id: account_id,
    processor: processor
  }

  if processor == 'stripe'
    endpoint = '/processor/stripe/bank_account_token/create'
    options.delete(:processor)
  elsif processor == 'apex'
    endpoint = '/processor/apex/processor_token/create'
    options.delete(:processor)
  end

  post_with_auth endpoint, ProcessorTokenResponse, **options
end