Skip to content

Instantly share code, notes, and snippets.

@azcoov
Last active June 25, 2019 13:25
Show Gist options
  • Save azcoov/4956135 to your computer and use it in GitHub Desktop.
Save azcoov/4956135 to your computer and use it in GitHub Desktop.
Stripe Checkout Form in HAML
= form_tag charges_path do
%article
%label{:class => "amount"}
%span Amount: $5.00
= javascript_include_tag "https://checkout.stripe.com/v2/checkout.js",
:class => "stripe-button",
:"data-key" => "#{Rails.configuration.stripe[:publishable_key]}",
:"data-description" => "30-day free trial",
:"data-amount" => "500",
:"data-image" => "/app-128x128.png"
#another example with all the available data attributes
= form_tag charges_path do
%article
%label{:class => "amount"}
%span Amount: $5.00
= javascript_include_tag "https://checkout.stripe.com/v2/checkout.js",
:class => "stripe-button",
:"data-key" => "#{Rails.configuration.stripe[:publishable_key]}",
:"data-label" => "Pay Now",
:"data-panel-label" => "Submit payment for",
:"data-name" => "ABC Company",
:"data-address" => "true",
:"data-description" => "30-day free trial",
:"data-amount" => "500",
:"data-image" => "/app-128x128.png"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment