Hi, i am using the square payment SDK in PHP and i try to make payment in USD with amount is $4.99 but i check in api log i see in response it is showing only 4. please clear the doubt. and my code is this.
$app_fee_money = new Money();
$app_fee_money->setAmount(4.99);
$app_fee_money->setCurrency(‘USD’);
In the Money
object, the amount
field indicates the amount in the base unit of the currency. The following table lists currencies and base units, with an example of each:
Currency | Base unit |
AUD | Cent (amount 100 in the Money object indicates $1.00) |
CAD | Cent (amount 100 in the Money object indicates $1.00) |
JPY | Yen (amount 100 in the Money object indicates ¥ 100) |
GBP | Pence (amount 100 in the Money object indicates £1.00) |
USD | Cent (amount 100 in the Money object indicates $1.00) |
EUR | Cent (amount 100 in the Money object indicates 1.00 EUR) |
For example, the following Money
object represents 400 cents ($4.00 USD). You’ll need to pass in 499 to charge $4.99.
What is the minimum amount we can charge at a time?
My all subscription and ticket are available in USD $ so if i have a plan $4.99 or i have ticket $2.99 in that case i have to put the money object setAmount(499)/ setAmount(299) for getting this amount is this right? or i have to do something else…
Case 1-
$amount = $4.99;
$app_fee_money = new Money();
$app_fee_money->setAmount(499);
$app_fee_money->setCurrency(‘USD’);
case 2 -
$amount = $2.99;
$app_fee_money = new Money();
$app_fee_money->setAmount(299);
$app_fee_money->setCurrency(‘USD’);
is this right please confirm…
Can i see the total received amount of sandbox transaction anywhere or only API log available for check. if any link where i can check the total amount so please share the link.
For testing i have made a payment with setAmount(499) after the successful payment i get this response here i seen that the amount is 499. this amount is dollar or cent?
{
“payment”: {
“id”: “9iymRx4MnDUkd8JKaRteLwujt6IZY”,
“created_at”: “2023-05-23T06:33:28.827Z”,
“updated_at”: “2023-05-23T06:33:28.938Z”,
“amount_money”: {
“amount”: 499,
“currency”: “USD”
},
“total_money”: {
“amount”: 499,
“currency”: “USD”
},
“approved_money”: {
“amount”: 499,
“currency”: “USD”
},
“status”: “APPROVED”,
“delay_duration”: “PT168H”,
“delay_action”: “CANCEL”,
“delayed_until”: “2023-05-30T06:33:28.827Z”,
That code would work. The absolute total is 499c or $4.99, and the app fee is then 299c or $2.99. I’ve been using code similar to this for some years.
You can charge a much smaller app fee, for instance, 10c or even 2c, I don’t think there’s a lower limit. There is a generous upper limit, can’t remember what it is, might be 80% or 90% but all of this is in the documentation if you read it.
The payment minimums are documented on this page.
You are correct. The amount will alway the base unit of the currency. In this case your charging $4.99 so that’s 499. The payment response that you got from Square is also in the base unit cents.