My setup is:
- Laravel 4.2
- Braintreepayments JS + PHP
- Laravel Braintree
I tried to add a new customer as showed in the tutorial which works fine. But when I tried to add a payment method from the Front-End with the given code from the JavaScript SDK. I used the Drop-In-UI which generates me a Payment Method Nonce which is part of my question.
I configured the PHP Backend with the Sandbox credentials and pasted the example Code given in the docs.
When I try to create a user, everything's fine:
$result = Braintree_Customer::create(array(
'id' => Auth::id(),
'firstName' => 'Mike',
'lastName' => 'Jones',
'company' => 'Jones Co.',
'email' => 'mike.jones@example.com',
'phone' => '281.330.8004',
'fax' => '419.555.1235',
'website' => 'http://example.com'
));
As soon as it comes to the payment nonce, nothing works:
$result = Braintree_Transaction::sale(array(
'amount' => '10.00',
'paymentMethodNonce' => Input::get('payment_method_nonce'),
'customer' => array(
'id' => Auth::id()
),
'options' => array(
'storeInVaultOnSuccess' => true,
)
));
The server keeps saying 93108: Unknown paymentMethodNonce
. This seems a little bit confusing and strange to me since the Input::get('payment_method_nonce')
represents a valid string.