【问题标题】:CheckOut payment with Braintree failed使用 Braintree 结帐付款失败
【发布时间】:2019-05-01 09:54:10
【问题描述】:

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

Braintree\Result\Error[错误=[Braintree\Error\ValidationErrorCollection/错误:[( )]],参数=交易=类型=销售,金额=4.4024E7, paymentMethodNonce=tokencc_bc_hxvh83_fkxpvx_9bg2mr_ny5prr_7n5, options=submitForSettlement=true, message=Amount 无效 格式。,creditCardVerification=,交易=,订阅=, 商家账户=,验证=]

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

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

    错误消息包含message=Amount is an invalid format.。您需要正确格式化金额。您目前正在传递4.4024E7。您可以在Braintree's developer docs 中找到有关格式化参数值的指南。

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

    【讨论】:

    • 感谢您的回复,我按照您的指示进行操作,然后我想将货币从美元换成越南盾,我遇到了问题,
    猜你喜欢
    • 2017-08-05
    • 2018-11-20
    • 2019-03-15
    • 2018-09-19
    • 2021-10-06
    • 2017-04-19
    • 2017-11-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多