LoginSignup
0
0

More than 3 years have passed since last update.

Stripe のサンプルプログラムが Uncaught IntegrationError: stripe.redirectToCheckout: になるとき

Last updated at Posted at 2020-01-24

現象

Stripe-samplescheckout-one-time-paymentsclient-only を試してて、http://localhost:4242/ を開き Buy for $5.0 ボタンを押しても次に遷移しません
スクリーンショット 2020-01-24 13.41.46.png

Console を見てみると掲題の Error で止まってます

スクリーンショット 2020-01-24 13.41.31.png

調査

successUrl must start with either http:// or https://.

との事なので index.html で successUrl を探すと

successUrl:
  DOMAIN + "/success.html?session_id={CHECKOUT_SESSION_ID}",

で、DOMAIN は

var DOMAIN = window.location.hostname;

console で見てみると

window.location.hostname
"localhost"

プロトコルないですね

workaround

var DOMAIN = "http://" + window.location.hostname;

無事にうごきました

おまけ

successUrl に遷移しようとしてまたエラーになるので、こっちのほうがいいかもしれません

var DOMAIN = "http://" + window.location.hostname + ":4242";
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0