Skip to content

Commit

Permalink
display stripe pricing on static page
Browse files Browse the repository at this point in the history
  • Loading branch information
yshmarov committed Mar 12, 2021
1 parent 7dcba4d commit 7fcc838
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/controllers/static_pages_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class StaticPagesController < ApplicationController

def pricing
end

end
1 change: 1 addition & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
<%= link_to "Posts", posts_path %>
<%= link_to "Pricing", pricing_path %>
<% if current_user %>
<%= link_to current_user.email, edit_user_registration_path %>
<%= link_to "Log out", destroy_user_session_path, method: :delete %>
Expand Down
11 changes: 11 additions & 0 deletions app/views/static_pages/pricing.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<h1>Pricing</h1>

<% @pricing = Stripe::Price.list(lookup_keys: ["good_year", "good_month"], expand: ["data.product"]) %>
<% @pricing.each do |price| %>
<br>
<%= price.product.name %>
<%= price.id %>
<%= price.unit_amount/100 %>
<%= price.currency %>
<%= price.recurring.interval %>
<% end %>
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Rails.application.routes.draw do
devise_for :users
root "posts#index"
get "pricing", to: "static_pages#pricing"
resources :posts
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end

0 comments on commit 7fcc838

Please sign in to comment.