Closed yogithesymbian closed 3 years ago
Hi @yogithesymbian I don't think the issue is coming from Midtrans library. From your log the error TypeError: Converting circular structure to JSON
is thrown by: node_modules/express/lib/response.js:1123:12
it is from Express library. Maybe your Express backend is unable to handle malformed HTTP response or something. Which you can check from your implementation of this line of code to know what function call produce the issue:
/src/controllers/notification.controller.js:55:26
apiClient.transaction.notification(notificationJson)
will work properly if the notificationJson
is a JSON object (or string) that have the correct attributes as example here: https://docs.midtrans.com/en/after-payment/http-notification?id=sample-for-various-payment-methods
From your example, the req.body
value is:
[{"statusResponse":"1"},{"transaction_time":"2","no":"3"},"yogi","as"]
Which is not a valid Midtrans notification JSON.
If you want to get a valid Midtrans notification JSON to test, I suggest you setup your Sandbox account to send HTTP notification to your backend: https://docs.midtrans.com/en/after-payment/http-notification?id=configuring-http-notifications-on-map
Then perform a sandbox test payment: https://docs.midtrans.com/en/technical-reference/sandbox-test
Hi @rizdaprasetya thanks in advance i dunno why but i have test right now and its work . last week i have tried with three value for the notificationJson variable
stringify(req.body); // notificationJson value
JSON.stringify({ ...req.body }); // notificationJson value
req.body; // notificationJson value // now its work dunno why how error is came on yesterday , i didnt touch anything .
sudo journalctl -u node-xxx -n 100 --no-pager
https://docs.midtrans.com/en/after-payment/http-notification
not solve dunno why, https://stackoverflow.com/questions/4816099/chrome-sendrequest-error-typeerror-converting-circular-structure-to-json , i have seen on https://github.com/Midtrans/midtrans-nodejs-client/issues/34 its work properly right ?