简体   繁体   中英

Checkout Error in Braintree Payment

I'm really stuck with this problem so it would be greatly appreciated if someone could help me.

After I enter amount to pay, choose the way to pay (some credit card for Test from BraintreeDevelopments ) IT FAILS!


: Undefined index: nonce in on line :未定义的索引:第行的现时数

: Undefined index: amount in on line :未定义的索引:第行的金额
Braintree\\Result\\Error[errors=[Braintree\\Error\\ValidationErrorCollection/errors:[( )]], params=transaction=type=sale, amount=, paymentMethodNonce=, options=submitForSettlement=true, message=Amount is required. Cannot determine payment method., creditCardVerification=, transaction=, subscription=, merchantAccount=, verification=]

And this is my 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
?>

But there are nonce and amount in line 5 and 6 -.- i dont understand why -.-

I had the same problem, and the issue was that in the getHeaders() function, I was putting the wrong params so I wrote it wrong.

I got:

params.put("Content-Type", "application/x-www-form-**urleooded**");

instead of

params.put("Content-Type", "application/x-www-form-**urlencoded**");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM