0/confirmation race attack double spend transactions I am developing a point of sale bitcoin app, which should accept "fast" transactions (~30 sec for merchant to accept). I researched double spending questions here already, but it is still unclear to me, what happens within the time frame before a transaction is actually included into a block.

Considering the case of a double spend attempt, where an attacker needs to pay to a merchant. The attacker creates and propagates a respective transaction A into the the bitcoin network. Transaction A is added to the main memory of mining nodes and is "waiting" for inclusion into one of the next blocks. The merchant is informed of the propagation of transaction A by the nodes he is connected to. Before transaction A is actually included in a block, the attacker creates and propagates another transaction B, which has the same inputs as A (double spend).


What happens if a miner (which has transaction A in his main memory) gets the conflicting transaction B?
Can a merchant be sure, that transaction A will be confirmed, if it is propagated successfully to let's say all or most miners?
Would a miner throw away transaction A and include B, if B has higher transaction fees, a smaller size in bytes, or of other attribute?
The bottom line is that there is no way for you to safely accept zero confirmation transactions. 


  What happens if a miner (which has transaction A in his main memory) gets the conflicting transaction B?


Depends on what software the miner is running and how they have configured it. 


Some nodes will reject it. 
Some nodes will accept it.
Some nodes will accept it conditionally. 


There's no knowing what people are running on mining nodes or what rules they have.


  Would a miner throw away transaction A and include B, if B has higher transaction fees, a smaller size in bytes, or of other attribute?


Ditto.


  Can a merchant be sure, that transaction A will be confirmed, if it is propagated successfully to let's say all or most miners?


Absolutely not. 

An alternative can be mined at any time, invalidating the original. This attack has been used in the real world to defraud websites of their Bitcoin payments to the tune of millions of dollars. Successful double spends can even happen once the transaction has been included in a block, which is why a large number of confirmations is suggested for people accepting Bitcoin as payment for services.