I'm new on Magento... I want to put this condition below after the user clicks on button to place an order to validate the card form just after confirm the order.

if (!$creditCardToken || !$senderHash) {
            $missingInfo = sprintf('Token do cartão: %s', var_export($creditCardToken, true));
            $missingInfo .= sprintf('/ Sender_hash: %s', var_export($senderHash, true));
                    "Falha ao obter o token do cartao ou sender_hash.
                    Ative o modo debug e observe o console de erros do seu navegador.
                    Se esta for uma atualização via Ajax, ignore esta mensagem até a finalização do pedido.
                'Falha ao processar seu pagamento. Por favor, entre em contato com nossa equipe.'

You probably need to use a sales_order_place_before or sales_order_place_after observer.

If you are very new, here's how to set up an observer.

Then you want to put your code in the Observer.php (gonna need some tweaking)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.