What happens to off chain transactions when the blockchain is reorganised? Many companies seem to use off chain transactions to transfer bitcoins between their own customers. What happens when a side chain gains dominance and no longer contains a block with the underlying transaction?

Let me explain my question with an example:


Customers A and B have Coinbase wallets.
Customer A receives 10 bitcoins from Block 1 into his wallet.
He instantly transfers 5 bitcoins to B's wallet using an off chain transaction.
B spends 1 bitcoin using and on chain transaction and that is included in Block 2.


This is displayed again below:

Block 1 -&gt; A -&gt; Off Chain -&gt; B -&gt; Block 2
10 BTC          5 BTC             1 BTC


Now suppose Block 1 and 2 now become invalidated due to a reorg of the blockchain and the initial 10 BTC transaction in Block 1 never makes it into a block again. However, the 1 BTC transaction from Block 2 does make it back into another block.

This could potentially corrupt an off chain system like Coinbase because it would end up not having the initial 10 BTC from Block 1 but customer A has still managed to give 5 BTC to customer B who has managed to send 1 BTC back to the blockchain.

In this example the off chain wallet company eg Coinbase, BitPay, Circle etc will potentially lose 10 BTC because it has already been allocated within their systems.

How do these companies resolve this issue and unravel their systems?

Do they detect that Block 1 no longer exists and then reverse the transaction to A and B's wallet? Or do they use other means? Maybe they just take the hit and lose the 10 BTC from their profits?
You answered your own question.  Rephrasing as a statement:


  [Some companies] detect that Block 1 no longer exists and then reverse the transaction to A and B's wallet.  [Other companies] take the hit and lose the 10 BTC from their profits.


Which solution to implement is a choice that's up to the company---neither solution is inherently better or worse.  (Reversing the transaction is better for short-term profits, but taking the hit (if you can prevent most fraud) may make your customers happy and increase long-term profits.)

Bitcoin payments are push-based: Alice pays Bob.  An alternative solution to this problem is requiring depositors to provide a backup payment method that is pull-based. In the event of a double-spend, this will allow Bob to charge Alice's debit card.  Although expensive, time-consuming, and not guaranteed to work, the ultimate pull-based payment method is going to court and suing the double-spender.