| Server IP : 173.209.174.21 / Your IP : 216.73.216.89 Web Server : Apache/2.4.58 (Ubuntu) System : Linux wcfs-server 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : nodor ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/thelittlebigshow/vendor-reg/ |
Upload File : |
<?php
include 'config.php'; // For Square credentials (access token, etc.)
// Include the Square PHP SDK
require 'vendor/autoload.php';
// Get the payment nonce and amount from the POST data
$nonce = $_POST['nonce'];
$amount = $_POST['amount']; // Amount to charge the vendor
// Set up the Square client with your credentials
$client = new Square\SquareClient([
'accessToken' => 'EAAAlz5GQCSDYN0gZ-0i24cxTnC-zrplTocIX9o9xE4-YBwTQHi2E1Co8ctYAkaN', // Your Square Access Token
'environment' => 'sandbox', // Change to 'production' in live environment
]);
// Create a payment request
$payments_api = $client->getPaymentsApi();
$body = new \Square\Models\CreatePaymentRequest(
$nonce,
new \Square\Models\Money($amount * 100, 'USD') // Amount in cents
);
try {
// Attempt the payment request
$response = $payments_api->createPayment($body);
// Check if the payment is successful
if ($response->isSuccess()) {
echo "Payment successful! Transaction ID: " . $response->getResult()->getPayment()->getId();
} else {
echo "Payment failed: " . $response->getErrors()[0]->getDetail();
}
} catch (Exception $e) {
echo "Error processing payment: " . $e->getMessage();
}
?>