Attempted payments threshold on an order #2339
Replies: 2 comments
-
This could be very useful to block "credit card testers". Had one doing like 100 tests on the same order. He might have stopped sooner if he had to create a new order with address etc after every 5 attempts. So my suggestion is some feature that allows the system to delete an order/cart after x failed attempts. |
Beta Was this translation helpful? Give feedback.
-
This is a setting that we can looked into in the future. If people are looking for a solution right now, here is some custom code you can add to a module to help with the prevention of checking out after failed transactions. Event::on(
Order::class,
Order::EVENT_DEFINE_RULES,
function(DefineRulesEvent $event) {
$event->rules[] = [['transactions'], function($attribute) use ($event) {
/** @var Order $order */
$order = $event->sender;
$failedTransactions = 0;
foreach ($order->getTransactions() as $transaction) {
if ($transaction->status !== Transaction::STATUS_FAILED) {
continue;
}
$failedTransactions++;
}
if ($failedTransactions > 3 && !$order->isCompleted) {
$event->sender->addError($attribute, 'Too many failed transactions. Please contact customer service.');
}
}];
}
); This is a simple implementation of the idea, this would prevent saving the cart/order at all. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Additional functionality to track attempted payments on an order.
Beta Was this translation helpful? Give feedback.
All reactions