#Tony-Checkout
1 messages ยท Page 1 of 1 (latest)
Hi Tony, can you tell me more about the problem? You want to pass amount as a param to create.php ?
sure, the code will be helpful
I checkout.js function on nxt click button I am trying to send the amount value to the create.php using ajax
but somehow it is always picking default value
dont know why
Please remove the publishable key from your code that you pasted as Discord is a public channel
// 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
if(!empty($amount)){
return $amount;
}
else{
return 2500;
}
}
I don't see the $amount param being passed to the fetch("/create.php" in line 42 or checkout.js
That's why it stays in the default value
Can you put some logs and see whether this ajax is called before initialize()?
A demo of a payment on Stripe
check this url
it first goes to nxt click then it initializes the js file
I checked that
thats why it takes time to load the stripe form in there
you can test in there
I'd recommend put some logs in calculateOrderAmount to make sure that the $amount is not empty.
okay going to do the test now then will ask you