Module: Stripe::JavascriptHelper

Defined in:
app/helpers/stripe/javascript_helper.rb

Constant Summary collapse

DEFAULT_STRIPE_JS_VERSION =
'v3'

Instance Method Summary collapse

Instance Method Details

#stripe_elements_tag(submit_path:, css_path: asset_path("stripe_elements.css"), js_path: asset_path("stripe_elements.js")) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/helpers/stripe/javascript_helper.rb', line 11

def stripe_elements_tag(submit_path:,
                        css_path: asset_path("stripe_elements.css"),
                        js_path: asset_path("stripe_elements.js"))

  render partial: 'stripe/elements', locals: {
    submit_path: submit_path,
    label_text: t('stripe_rails.elements.label_text'),
    submit_button_text: t('stripe_rails.elements.submit_button_text'),
    css_path: css_path,
    js_path: js_path
  }
end

#stripe_javascript_tag(stripe_js_version = DEFAULT_STRIPE_JS_VERSION) ⇒ Object



5
6
7
8
9
# File 'app/helpers/stripe/javascript_helper.rb', line 5

def stripe_javascript_tag(stripe_js_version = DEFAULT_STRIPE_JS_VERSION)
  stripe_js_version = stripe_js_version.to_s.downcase

  render 'stripe/js', stripe_js_version: stripe_js_version
end