ruby on rails - Changing Stripe currency from default USD to GBP -


i think have changed parts of code necessary use gbp rather usd. however, whilst correct figures displaying in stripe card charging modal 'charge' button still displays usd.

my current view:

    <%= link_to 'enroll', course_enrollments_path(@course), class: 'btn btn-primary', method: :post %>     <%= form_tag course_enrollments_path(@course) %>      <script src="https://checkout.stripe.com/checkout.js" class="stripe-button"             data-key="<%= rails.configuration.stripe[:publishable_key] %>"             data-description="a month's subscription"             data-amount="<%= (@course.cost * 100).to_i %>"></script>     <% end %> 

my current controller:

def create     current_user.enrollments.create(course: current_course)      # amount in pence     @amount = (current_course.cost * 100).to_i      customer = stripe::customer.create(       :email => current_user.email,       :card  => params[:stripetoken]     )      charge = stripe::charge.create(       :customer    => customer.id,       :amount      => @amount,       :description => 'flixter enrollment',       :currency    => 'gbp'     )      redirect_to course_path(current_course)    rescue stripe::carderror => e     flash[:error] = e.message     redirect_to root_path     end 

apologies, if haven't given enough information or terminology wrong - new coding , stackoverflow :)

thanks!

you ned add currency stripe checkout below

<script src="https://checkout.stripe.com/checkout.js" class="stripe-button"         data-key="<%= rails.configuration.stripe[:publishable_key] %>"         data-description="a month's subscription"         data-amount="<%= (@course.cost * 100).to_i %>"         data-currency="gbp"         ></script> 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -