使用Braintree的CheckOut付款失败

问题描述 投票:0回答:1

当我点击结帐付款时,我的订单不会发送到服务器(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格式无效。,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
java php android braintree braintree-sandbox
1个回答
0
投票

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

错误消息包含message=Amount is an invalid format.。您需要正确格式化数量。你目前正在通过4.4024E7。您可以在Braintree's developer docs中找到格式化参数值的准则。

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

© www.soinside.com 2019 - 2024. All rights reserved.