This is a quote from the book "On Zero Confirmation Transactions" by Chris Pacia
...w to double spend

Double spending an unconfirmed Bitcoin transaction is actually rather easy for people with the technical ability. The easiest way is to create two transactions
which spend the same Bitcoins. The first transaction sends the coins to the merchant, while the second sends the coins back to yourself. The trick here is you need to make sure the merchant see s the legitimate transaction first and the double spend second (or preferably not at all), while ensuring the mining pools see the double spend first and the legitimate transaction second. Given...
read full book block explorer