veritrans / SNAP-Woocommerce

MIT License
19 stars 16 forks source link

Error Testing Notification callback #6

Closed agung-wete closed 6 years ago

agung-wete commented 6 years ago

While testing Test notification callback, got this:

[STDERR] PHP Warning: Illegal string offset 'transaction_id' in /var/www/vhosts/XXX/wp-content/plugins/midtrans-woocommerce/lib/veritrans/Veritrans/Notification.php on line 20

[STDERR] PHP Fatal error: Uncaught Exception: Veritrans Error (404): Transaction doesnt exist. in /var/www/vhosts/XXXXX/wp-content/plugins/midtrans-woocommerce/lib/veritrans/Veritrans/ApiRequestor.php:96

Using ver 2.4.5

agung-wete commented 6 years ago

Got something:

$raw_notification = json_decode(file_get_contents($input_source), true);    
// error_log('TIPE:'.gettype($raw_notification) ); //result is "string" not array

//need to decode again
$raw_notification = json_decode($raw_notification, true);
rizdaprasetya commented 6 years ago

Hi @agung-wete Thanks for contacting.

Unfortunately for now the Test notification callback is in incorrect format. So please ignore the error caused by it. For testing with Woocommerce, we recommend you to do transaction in your Woocommerce site using Midtrans Gateway which set to use sandbox environment, your server will receive correct notification callback using this method.

Thanks.

agung-wete commented 6 years ago

ya, kami berhasil test dengan mode sandbox, tapi kami harus ubah :

$raw_notification = json_decode(file_get_contents($input_source), true);    
// error_log('TIPE:'.gettype($raw_notification) ); //result is "string" not array

//need to decode again
$raw_notification = json_decode($raw_notification, true);

PHP ver 7.1, plugin ver 2.4.5