我正在开发一个 Ruby on Rails 应用程序,我计划在其中集成 Stripe 支付。我正在使用stripe
宝石。我打算使用 Elements,如此处所述。
我包括这样的 Stripe js:
= javascript_include_tag 'https://js.stripe.com/v3/'
在我的charges.coffee
文件中,我有这个:
$(document).on 'turbolinks:load', ->
stripe = Stripe("<%= Rails.application.secrets['STRIPE_PUBLISHABLE_KEY'] %>")
elements = stripe.elements()
当我加载应用程序时,我目前在 Safari 中收到以下错误:
Refused to execute a script because its hash, its nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
关于我可以做些什么来解决这个问题的任何想法?