I’m using the guide over at Take Online Payments with Square APIs in 3 Steps | Square
Everything is installed; I installed the Square SDK using Composer, made sure I’m using the latest version of PHP, and am using sandbox credentials.
I have a simple form that successfully gets a idempotencyKey, but when I try to process the payment at my “process-payment.php” file, I constantly keep getting the following error:
“detail”: “Must supply amount_money”,
I’m using the Money class to create the object, am using setAmount() and setCurrency(Currency:CAD), and no php errors - just the errors from square’s side. Looking at the error, it reqires an “amount_money” field, but looking at the docs over at square-php-sdk/create-payment-request.md at master · square/square-php-sdk · GitHub , it looks like this is actually called “amountMoney”.
The PHP I’m using is:
$money = new Money; $money->setAmount(floatval($total)*100); $money->setCurrency(Currency::CAD); $create_payment_request = new CreatePaymentRequest($token, $idempotencyKey, $money);
Is this an error on Square’s side? I can provide some basic code if needed, but I pulled it all from the Github repo and the Square site.