diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php
index 9cecbc90885..69ce8977030 100644
--- a/htdocs/public/payment/newpayment.php
+++ b/htdocs/public/payment/newpayment.php
@@ -212,6 +212,11 @@ $parameters = [
'validpaymentmethod' => &$validpaymentmethod
];
$reshook = $hookmanager->executeHooks('doValidatePayment', $parameters, $object, $action);
+if ($reshook < 0) {
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+} elseif ($reshook > 0) {
+ print $hookmanager->resPrint;
+}
// Check security token
$valid = true;
@@ -1674,6 +1679,12 @@ if ($action != 'dopayment')
'object' => $object
];
$reshook = $hookmanager->executeHooks('doCheckStatus', $parameters, $object, $action);
+ if ($reshook < 0) {
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+ } elseif ($reshook > 0) {
+ print $hookmanager->resPrint;
+ }
+
if ($source == 'order' && $object->billed)
{
print '
'.$langs->trans("OrderBilled").'';
@@ -1699,6 +1710,12 @@ if ($action != 'dopayment')
'paymentmethod' => $paymentmethod
];
$reshook = $hookmanager->executeHooks('doAddButton', $parameters, $object, $action);
+ if ($reshook < 0) {
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+ } elseif ($reshook > 0) {
+ print $hookmanager->resPrint;
+ }
+
if ((empty($paymentmethod) || $paymentmethod == 'paybox') && !empty($conf->paybox->enabled))
{
print '