Braintree的CheckOut付款失败

时间:2019-05-01 09:54:10

标签: java php android braintree braintree-sandbox

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

  

Braintree \ Result \ Error [errors = [Braintree \ Error \ ValidationErrorCollection / errors:[(   )]],params = transaction = type = sale,金额= 4.4024E7,   PaymentMethodNonce = tokencc_bc_hxvh83_fkxpvx_9bg2mr_ny5prr_7n5,   options = submitForSettlement = true,消息=金额无效   格式。creditCardVerification =交易=订阅=   vendorAccount =,验证=]

///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

1 个答案:

答案 0 :(得分:0)

完全公开,我在Braintree工作。如有其他疑问,请联系Support

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

例如,如果您通过4.40作为金额值,则交易应该成功。