/home/desid573/public_html/gcdriver
Edit: /home/desid573/public_html/gcdriver/test3.php (1269B)
setHost("https://connect.squareupsandbox.com");
$api_config->setAccessToken($access_token);
$api_client = new \SquareConnect\ApiClient($api_config);
$apiInstance = new SquareConnect\Api\PaymentsApi($api_client);
$body = new \SquareConnect\Model\CreatePaymentRequest();
// Set your customer_id and customer_card_id
$body->setSourceId("ccof:0ecL6VchwaJTqeSK4GB");
$body->setCustomerId("AXTKZ34RXCRTSAJKC8T8P91630");
// Set the payment information
$body->setIdempotencyKey("1234564");
$body->setAutocomplete(true);
$body->setReferenceId("ref123");
// Set the charge amount to 10 USD
$chargeAmount = new SquareConnect\Model\Money();
$chargeAmount->setAmount(100);
$chargeAmount->setCurrency("AUD");
$body->setAmountMoney($chargeAmount);
//make the call
try {
$result = $apiInstance->createPayment($body);
print_r($result);
echo $result["payment"]["status"]."
";
echo $result["payment"]["total_money"]["amount"];
} catch (Exception $e) {
echo 'Exception when calling PaymentsApi->createPayment: ', $e->getMessage(), PHP_EOL;
}
?>