harrypujianto / Veritrans-Laravel5

33 stars 45 forks source link

Get info from midtrans and save to database #17

Closed robertnicjoo closed 6 years ago

robertnicjoo commented 6 years ago

Hi, I have working snap where I can purchase successfully but on redirect i go to another page and receive error while my transaction was successful.

Here is how my url's are:

domain/orders (I pay here with snap) domain/orderspayonline/7 (here is where i redirect and receive error)

ERROR:

Class 'App\Veritrans\Exception' not found

on

      else {
        $result_array = json_decode($result);
        if ($info['http_code'] != 201) {
        $message = 'Midtrans Error (' . $info['http_code'] . '): '
            . implode(',', $result_array->error_messages);
        throw new Exception($message, $info['http_code']);  //on this line

      }

What I NEED:

  1. Redirect back to my domain/orders page and show some Session::flash
  2. Get Order ID and transaction result (which is success) so I can save in my orders table in order to change status of my order in DB.

Thank you.

harrypujianto commented 6 years ago

https://snap-docs.midtrans.com/#snap-js you can use onsuccess, onpending, onclose, and onerror. to show the result on the same page where the snap pop up open

robertnicjoo commented 6 years ago

@harrypujianto and for retrieving data from midtrans?

robertnicjoo commented 6 years ago

@harrypujianto Ok i do get such info on my transaction:

8574

but still i'm redirecting to another page and receive error.

eginugraha commented 6 years ago

change use App\Exceptions\VeritransException as VeritransException; to use App\Exceptions\VeritransException as Exception;

harrypujianto commented 6 years ago

@eginugraha Thank you