braintree / braintree_php

Braintree PHP library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
547 stars 224 forks source link

Auth error when trying to make a transaction #291

Closed ghost closed 3 years ago

ghost commented 3 years ago

When adding the basic example code to my Laravel project I keep getting this error

image

I'm generating the auth token on the server-side, sending it to the client and all the fields are working. When trying to execute a transaction()->sale() on the server-side I get the above error

$gateway = new Braintree\Gateway([
    'environment' => config('services.braintree.environment'),
    'merchantId'  => config('services.braintree.merchantId'),
    'publicKey'   => config('services.braintree.publicKey'),
    'privateKey'  => config('services.braintree.privateKey')
]);

$result = $gateway->transaction()->sale([
    'amount' => '5.99',
    'paymentMethodNonce' => $request->get('nonce'),
  ]);

The credentials are also correct because I can create a customer but not a transaction

Thanks

crookedneighbor commented 3 years ago

Your API user probably doesn't have the permissions set to create a transaction. Reach out to our support team for help with this. https://help.braintreepayments.com/