What am I doing wrong? According to docs this should work! But I get 91565!
Array ( [payment_method_nonce] => a7f99043-febb-44f7-90bc-89a766860706 ) 91565: Unknown paymentMethodNonce.
if($_POST){ print_r($_POST); $nonce = $_POST["payment_method_nonce"]; $result = Braintree_Transaction::sale( array( 'paymentMethodNonce' => $nonce, 'amount' => '100.00' ) ); if ($result->success) { echo($result->customer->id); echo($result->customer->creditCards[0]->token); } else { foreach($result->errors->deepAll() AS $error) { echo($error->code . ": " . $error->message . "\\n"); } } }
The code is correct. The problem is that the nonce was generated by our demo merchant and you tried to use it to create a transaction for a different merchant.
Payment method nonces contain no data - they are merchant-specific identifiers for payment details we've stored for that merchant. So they can't be used by another merchant.
These docs will show you how to create your own client-side v.zero integration: https://developers.braintreepayments.com/javascript+php/start/overview
Feel free to contact Braintree support at support@braintreepayments.com .
I had this same issue - in my instance I had updated my credit card form and the js script and had forgotten to pass the client token to the javascript. I was working in Laravel, so first I generated the clientToken:
$clientToken = Braintree_ClientToken::generate();
then in the javaScript I wrote the clientToken for the authorization:
braintree.client.create({
authorization: 'sandbox_g42y39zw_348pk9cgf3bgyw2b'
to:
braintree.client.create({
authorization: '{{ $clientToken }}'
etc...
每当您发布付款捕获请求时,都需要生成New Nonce代码。
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.