#Stephane
1 messages ยท Page 1 of 1 (latest)
Are you using some kind of plugin/third-party?
You'll need to help me understand what is the 'domain' in this instance?
How are you integrating with Stripe
no the standard test that I use
but impossible to setlle the key of the second account on this domain
I don't know what this means
A demo of a payment on Stripe
works....
can you try?
I use the key of account 1 !
If I use on this domaine the key of account 2 this is not working!
That URL doesn't work for me, I see errors when I click the button
Your endpoint to create the Payment Intent is returning this error:
"Return value of calculateOrderAmount() must be of the type int, null returned"
why is it working on my place?
I've no idea, you'd need to workout where that error is thrown from
so in your place you don't see the form at all?
I don't. The API call to create the Payment Intent fails so the Payment Element can't initialise without the client_secret:
in order to create a payment element, you must pass a valid PaymentIntent or SetupIntent client secret when creating the Elements group.
e.g. stripe.elements({clientSecret: "{{CLIENT_SECRET}}"})
That is crasy this work at my place
๐ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
I simpe use the code from Stripe
this is the code from the doc...
work on my machine... but not on my phone!
Got crasy
what exactly didn't work on your phone?
there's an error in your Php code
as my colleague explained
maybe you didn't push your code to your server
this happens between different environments
opera mot
It's not browser related
and on my photo not work at all
there's an issue with your backend code that runs on https://shop.internationalschoolphotography.com/
but i copy that from Stripe
would you please share your backend code?
<?php
require '../vendor/autoload.php';
// This is your test secret API key.
//
\Stripe\Stripe::setApiKey('sk_xxxxxxxx');
function calculateOrderAmount(array $items): int {
// Replace this constant with a calculation of the order's amount
// Calculate the order total on the server to prevent
// people from directly manipulating the amount on the client
return 2400;
}
header('Content-Type: application/json');
try {
// retrieve JSON from POST body
$jsonStr = file_get_contents('php://input');
$jsonObj = json_decode($jsonStr);
// Create a PaymentIntent with amount and currency
$paymentIntent = \Stripe\PaymentIntent::create([
'amount' => calculateOrderAmount($jsonObj->items),
'currency' => 'eur',
'automatic_payment_methods' => [
'enabled' => true,
],
]);
$output = [
'clientSecret' => $paymentIntent->client_secret,
];
echo json_encode($output);
} catch (Error $e) {
http_response_code(500);
echo json_encode(['error' => $e->getMessage()]);
}
on my place work with a key and not with the other...
for this reason was thining related to the domain where my code is hosted
if I change
await fetch("/create.php", {...
with
await fetch("../create.php", {
Where my create located not work as well for me
ohhh if I try a test card is it going to my local server ๐ฆ
it's not about test cards
on the server where the URL you sent is running, the code is not executing correctly
you need to check that
but that is not my code... that the one from Stripe