diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php
index 97fe2387d8d..c944334fdb4 100644
--- a/htdocs/public/payment/newpayment.php
+++ b/htdocs/public/payment/newpayment.php
@@ -291,6 +291,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
$tmpsource = $source;
@@ -2026,6 +2031,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").'';
} elseif ($source == 'invoice' && $object->paye) {
@@ -2047,6 +2058,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 '