diff --git a/.env b/.env index 166934f..45a32c4 100644 --- a/.env +++ b/.env @@ -1,4 +1,5 @@ REACT_APP_BROKER_URL=http://localhost:9000 REACT_APP_ICE_SERVERS_URL=http://localhost:9000/iceservers REACT_APP_STRIPE_API_KEY=pk_test_8M3NHrF1eI2b84ubF4F8rSTe0095R3f0My +REACT_APP_STRIPE_URL=http://localhost:9000 REACT_APP_VERSION=$npm_package_version \ No newline at end of file diff --git a/.env.production b/.env.production index 8967d70..6e3dba7 100644 --- a/.env.production +++ b/.env.production @@ -1,4 +1,5 @@ REACT_APP_BROKER_URL=https://test.owlbear.rodeo REACT_APP_ICE_SERVERS_URL=https://test.owlbear.rodeo/iceservers -REACT_APP_STRIPE_API_KEY=pk_live_MJjzi5djj524Y7h3fL5PNh4e00a852XD51 +REACT_APP_STRIPE_API_KEY=pk_test_8M3NHrF1eI2b84ubF4F8rSTe0095R3f0My +REACT_APP_STRIPE_URL=https://payment.owlbear.rodeo REACT_APP_VERSION=$npm_package_version \ No newline at end of file diff --git a/src/routes/Donate.js b/src/routes/Donate.js index 35f4268..2a8f8d9 100644 --- a/src/routes/Donate.js +++ b/src/routes/Donate.js @@ -49,7 +49,17 @@ function Donate() { return; } - const response = await fetch("/create-session", { method: "POST" }); + const response = await fetch( + process.env.REACT_APP_STRIPE_URL + "/create-checkout-session", + { + method: "POST", + headers: { + Accept: "application/json", + "Content-Type": "application/json", + }, + body: JSON.stringify({ currency: "usd", amount: value * 100 }), + } + ); const session = await response.json(); const result = await stripe.redirectToCheckout({ sessionId: session.id });