Class: SolidusBraintree::ClientTokensController

Inherits:
Spree::Api::BaseController
  • Object
show all
Defined in:
app/decorators/controllers/solidus_braintree/client_tokens_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
# File 'app/decorators/controllers/solidus_braintree/client_tokens_controller.rb', line 9

def create
  token = @gateway.generate_token
  if token
    render json: { client_token: token, payment_method_id: @gateway.id }
  else
    render json: { error: Gateway::TOKEN_GENERATION_DISABLED_MESSAGE }, status: :unprocessable_entity
  end
end