Skip to content
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

22 lines (17 sloc) 561 Bytes
require_once 'shared.php';
function calculateOrderAmount($items) {
// 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 1400;
$paymentIntent = \Stripe\PaymentIntent::create([
'amount' => calculateOrderAmount($body->items),
'currency' => $body->currency,
$output = [
'publishableKey' => $config['stripe_publishable_key'],
'clientSecret' => $paymentIntent->client_secret,
echo json_encode($output);
You can’t perform that action at this time.