Square 销售点未读取正确的美元金额

Square Point of Sale not reading correct dollar amount

我正在尝试使用文档中的示例代码来测试 Web API。我可以成功调用 APP 并生成任何错误,但是我硬编码到我的脚本中的美元金额没有正确传递。好像差了两位数。

I.E $500 转换为 $5

我尝试过使用文本字段的值以及在值中进行硬编码。每次结果都一样。

我在单击网络表单上的按钮时调用代码:

 <!--- Square CC Processing --->
   <script>  
          document.getElementById("do_square_payment_btn").onclick = function (e) {

            e.preventDefault();

            var amount = $('#payment_amount_mobile').val();
            //var amountFixed = amount.toFixed(2);
            console.log("Amount being passed in on square button click " + amount);
            var dataParameter = {
                "amount_money": {
                    "amount" : '5000' ,
                    "currency_code" : "USD"
                },
                "callback_url" : "https://jaydien.ezservicetrax.com", // Replace this value with your application's callback URL
                "client_id" : "sq0idp-CHLAPYt9s1L594ZZZysDSQ", // Replace this value with your application's ID
                "version": "1.3",
                "notes": "Computer Service",
                "options" : {
                "supported_tender_types" : ["CREDIT_CARD"] //,"CASH","OTHER","SQUARE_GIFT_CARD","CARD_ON_FILE"
                }
            };

            console.log(amount);
            console.log("Square button clicked");
            console.log("square-commerce-v1://payment/create?data=" + encodeURIComponent(JSON.stringify(dataParameter)));
            location.href = "square-commerce-v1://payment/create?data=" + encodeURIComponent(JSON.stringify(dataParameter));

            };  


          //window.location = "square-commerce-v1://payment/create?data=" + encodeURIComponent(JSON.stringify(dataParameter));

    </script>

我做错了什么?

它完全按照预期的方式工作。每 the documentation:

Note that you specify the amount in the smallest denomination of the applicable currency. For example, US dollar amounts are specified in cents. See Working with monetary amounts for details.

因此,500 美元的价值代表 5 美元。