Class: Ecko::Plugins::Stripe::Checkout

Inherits:
Authenticator show all
Defined in:
lib/ecko/plugins/stripe/checkout.rb

Instance Attribute Summary

Attributes inherited from Authenticator

#params

Instance Method Summary collapse

Methods inherited from Authenticator

execute, #initialize, #state_secret

Constructor Details

This class inherits a constructor from Ecko::Plugins::Stripe::Authenticator

Instance Method Details

#runObject



7
8
9
# File 'lib/ecko/plugins/stripe/checkout.rb', line 7

def run
  session.url
end

#sessionObject

Creates a session based on the parameters send



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ecko/plugins/stripe/checkout.rb', line 12

def session
  @session ||= ::Stripe::Checkout::Session.create(
    payment_method_types: payment_method_types,
    mode: 'payment',
    submit_type: params[:submit_type] || 'pay',
    client_reference_id: SecureRandom.uuid,
    success_url: success_url,
    cancel_url: cancel_url,
    line_items: line_items
  )
end