Js callback is ignored in metamask pay confirmed - if multiple payments in popup

When paying via MetaMask, a situation may arise when there are several unconfirmed payments:

The problem is that in this case, when one of the transactions is confirmed, the js callback is ignored. Js starts processing only after the last transaction is confirmed. As a result, two transactions are paid instead of one.

Tell me how to make sure that all transactions in the pop-up window are not ignored and are picked up in js.

I repeat: transactions are ignored by js - if there are several of them in popup, only the last transaction is processed. Most likely you need to add something in the js code, only I don’t know what.

source code:

const trans = signer.sendTransaction(tx).then( async function (res) {
                App.saveTransaction(res.hash, orderId);
                payIsReturnTransactionId = false;
                setTimeout(App.checkPayIsExpired, 120000, orderId);
                return res.wait();
            }).then(function (tx) {
                payIsReturnTransactionId = true;
                App.checkAndPay(tx.transactionHash, orderId); // проверка и проведение платежа
            }).catch(function (error) {
                if (error.code =="4001"){
                } else {
                   App.errorPay(orderId, error.code);

Just in case, I make an additional screen. zhs is ignored when there is more than one pending payment.

Hello @shaspetr

try to delete ASYNC

1 Like

async deleted.

reunfortunately didn’t help. Transaction is still ignored js - if it is not the last one in popup.

1 Like

Are you running a catch block? If yes, what is the error code?
Try to do this and show me the output

.catch(error => console.log(error))

1 Like

Sorry for the delay in reply, i put the code

After confirmation in the popup, the console is empty

Triggered and displayed in the console only for the last payment.

1 Like

Who wrote this manual? It looks very outdated


Are you using this code?

params: [
    from: '0xb60e8dd61c5d32be8058bb8eb970870f07233155',
    to: '0xd46e8dd67c5d32be8058bb8eb970870f07244567',
    gas: '0x76c0', // 30400
    gasPrice: '0x9184e72a000', // 10000000000000
    value: '0x9184e72a', // 2441406250

    method: 'eth_sendTransaction',
  .then((result) => {
    // The result varies by RPC method.
    // For example, this method will return a transaction hash hexadecimal string on success.
  .catch((error) => {
    // If the request fails, the Promise will reject with an error.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.