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) {
$(".pay-process-description").show();
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"){
App.cancelPay(orderId);
} else {
App.errorPay(orderId, error.code);
}
});