I am currently developing a Ruby on Rails application and I am looking to incorporate Stripe payments using the stripe
gem. My plan is to utilize Elements, as outlined in this documentation provided by Stripe.
To include Stripe js, I have added the following line of code:
= javascript_include_tag 'https://js.stripe.com/v3/'
In my charges.coffee
file, I have implemented the following code snippet:
$(document).on 'turbolinks:load', ->
stripe = Stripe("<%= Rails.application.secrets['STRIPE_PUBLISHABLE_KEY'] %>")
elements = stripe.elements()
Upon loading the application, I am encountering an error specifically in Safari:
Refused to execute a script because its hash, nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
Does anyone have suggestions on how I can resolve this issue?