hasajacykacperek Posted July 6, 2020 Share Posted July 6, 2020 Hello, I want to debug my payment callback, there is no logs in panel, code: <?php /** * Paynow Payment Gateway Callback handler for WHMCS */ require_once __DIR__ . '/../../../init.php'; require_once __DIR__ . '/../paynow/vendor/autoload.php'; use Paynow\Notification; use WHMCS\Database\Capsule; $whmcs->load_function('gateway'); $whmcs->load_function('invoice'); $gatewayModuleName = basename(__FILE__, '.php'); $gatewayParams = getGatewayVariables($gatewayModuleName); if (!$gatewayParams['type']) { die("Module Not Activated"); } //Select the api credentials by gateway mode $gatewayMode = $gatewayParams['gatewayMode']; if ($gatewayMode == 'Test') { $consumer_key = $gatewayParams['testConsumerKey']; $consumer_secret = $gatewayParams['testConsumerSecret']; } else { $consumer_key = $gatewayParams['liveConsumerKey']; $consumer_secret = $gatewayParams['liveConsumerSecret']; } $payload = trim(file_get_contents('php://input')); $headers = getallheaders(); $notificationData = json_decode($payload, true); logTransaction($gatewayParams["name"], var_dump($notificationData), "Unsuccessful"); $invoiceId = checkCbInvoiceID($notificationData['externalId'], $gatewayParams['name']); $transactionId = checkCbTransID($notificationData['paymentId']); logTransaction($gatewayParams["name"], var_dump($invoiceId), "Unsuccessful"); logTransaction($gatewayParams["name"], var_dump($transactionId), "Unsuccessful"); try { new Notification($consumer_secret, $payload, $headers); $isVerificationSuccessful = true; logTransaction($gatewayParams['name'], ['Invoice ID' => $invoiceId], 'Success'); //Add payment information to given invoice ID addInvoicePayment( $invoiceId, $transactionId, 100, 0, // Payment Fee $gatewayModuleName ); } catch (Exception $exception) { logTransaction($gatewayParams["name"], $exception, "Unsuccessful"); header('HTTP/1.1 400 Bad Request', true, 400); } logTransaction($gatewayParams["name"], $_POST, "Success"); header('HTTP/1.1 202 Accepted', true, 202); 0 Quote Link to comment Share on other sites More sharing options...
0 HostT Posted January 26, 2021 Share Posted January 26, 2021 Setup xdebug on your local installation and just set a breakpoint in your code. Even though WHMCS is encoded, you can still use xdebug on your own code 0 Quote Link to comment Share on other sites More sharing options...
0 Rider61 Posted July 28, 2021 Share Posted July 28, 2021 I am using var_dump for debugging. I can't undestand! who is initializing the callback function and when. I never get there ... 0 Quote Link to comment Share on other sites More sharing options...
0 carolinef.pl Posted September 26, 2021 Share Posted September 26, 2021 Hej hasajacykacperek! Udało się Tobie zaimplementować hooka z infaktem? Walczę z tym kilka dobrych dni i nie potrafię tego przeskoczyć 😞 0 Quote Link to comment Share on other sites More sharing options...
Question
hasajacykacperek
Hello, I want to debug my payment callback, there is no logs in panel, code:
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.