使用 Braintree 的 CheckOut 付款失败

CheckOut payment with Braintree failed

当我点击结帐付款时,我的订单没有发送到服务器 (SQL)。 这是我的日志:

Braintree\Result\Error[errors=[Braintree\Error\ValidationErrorCollection/errors:[( )]], params=transaction=type=sale, amount=4.4024E7, paymentMethodNonce=tokencc_bc_hxvh83_fkxpvx_9bg2mr_ny5prr_7n5, options=submitForSettlement=true, message=Amount is an invalid format., creditCardVerification=, transaction=, subscription=, merchantAccount=, verification=]

///file config php braintree here

//braintree_init
    braintree_init.php:
<?php
    session_start();
    require_once ("lib/autoload.php");

    if (file_exists(__DIR__ . "/../.env"))
    {

        $dotenv = new Dotenv\Dotenv(__DIR__ . "/../");
        $dotenv->load();
    }
    //add key value form braintree
    Braintree_Configuration::environment('sandbox');
    Braintree_Configuration::merchantId('33z8qvth85f5z6bs');
    Braintree_Configuration::publicKey('wh99mdq8ymvvkkms');
    Braintree_Configuration::privateKey('d65a6142e8e5123521143737e6a78601');
    ?>

//check out
    checkout.php:
    <?php
    require_once ("braintree_init.php");
    require_once ('lib/Braintree.php');

    $nonce = $_POST['nonce'];
    $amount = $_POST['amount'];

    $result = Braintree_Transaction::sale([
        'amount' => $amount,
        'paymentMethodNonce' => $nonce,
        'options' => [
            'submitForSettlement' => True
        ]
    ]);
    echo $result;
    ?>

//// file main check token 

    file main.php
    <?php
    require_once ("braintree_init.php");
    require_once ('lib/Braintree.php');

result send to order failed

完全公开,我在 Braintree 工作。如果您有任何其他问题,请联系 Support

错误消息包含 message=Amount is an invalid format.。您需要正确格式化金额。您目前超过了 4.4024E7。您可以在 Braintree's developer docs.

中找到参数值格式化指南

例如,如果您将4.40作为金额值传递,交易应该会成功。