marprin / laravel-midtrans

[Archived] A payment gateway (Midtrans) wrapper for Laravel
25 stars 6 forks source link

error 401 Unauthorized #4

Closed billyanto closed 6 years ago

billyanto commented 6 years ago

i got this problem when i try your code

Client error: POST https://app.sandbox.midtrans.com/snap/v1/transactions resulted in a 401 Unauthorized response:\n {"error_messages":["Access denied due to unauthorized transaction, please check client or server key","Visit https://sna (truncated...)\n

however i don't know what is coce:

'is_production' => env('MIDTRANS_IS_PRODUCTION', true)

because i use sandbox

marprin commented 6 years ago

Hi @billyanto, as you've stated, you're using the sandbox mode.

'is_production' => env('MIDTRANS_IS_PRODUCTION', true) define the value of environment for the key and if it's not supplied on the .env file, it will take the true and it means production mode.

To solve your problem, add key MIDTRANS_IS_PRODUCTION to your .env file and set as false.

Thank you.