Added selectable num of records on each listing page, fixed up Pagination Records UI, added new stripe library, further worked on stripe integration, fixed mispelling in client details

This commit is contained in:
johnny@pittpc.com
2021-02-10 11:21:38 -05:00
parent c748388b9a
commit 530d46a812
352 changed files with 16193 additions and 7090 deletions

42
create.php Normal file
View File

@@ -0,0 +1,42 @@
<?php
include("config.php");
include("check_login.php");
include("functions.php");
?>
<?php
require 'vendor/stripe-php-7.72.0/init.php';
// This is your real test secret API key.
\Stripe\Stripe::setApiKey("$config_stripe_secret");
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
// customers from directly manipulating the amount on the client
return 1400;
}
header('Content-Type: application/json');
try {
// retrieve JSON from POST body
$json_str = file_get_contents('php://input');
$json_obj = json_decode($json_str);
$paymentIntent = \Stripe\PaymentIntent::create([
'amount' => calculateOrderAmount($json_obj->items),
'currency' => 'usd',
]);
$output = [
'clientSecret' => $paymentIntent->client_secret,
];
echo json_encode($output);
} catch (Error $e) {
http_response_code(500);
echo json_encode(['error' => $e->getMessage()]);
}