gpt4 book ai didi

java - Braintree 结账付款失败

转载 作者:行者123 更新时间:2023-12-02 06:07:33 27 4
gpt4 key购买 nike

当我点击结帐付款时,我的订单未发送到服务器(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 作为金额值,交易应该会成功。

关于java - Braintree 结账付款失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55934459/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com