It could be the Oracle that traces the delivery - many DHL-type delivery networks provide APIs to their information systems. Although there are certain subtleties with determining the identifier of the tracked "package".
Your biggest problem is that a contract can only receive assets which are inside the blockchain. You can't send regular money ($, €, any fiat) in blockchain and you can't send goods in blockchain.
What you'd basically need is some way for an external party to tell the contract about the state of the assets (money and goods) outside blockchain. But it's ...
It works the same as any other transactions: You can call a view or pure function in a transaction, and the transaction can be mined as usual. It just won't do anything of course, since it's a view or pure function.
The base number of gas needed for any transaction is 21,000 gas. Like you mentioned, sending Ether from an EOA to an EOA, without any data in the transaction, will always take exactly 21,000 gas.
Any gas on top of that is determined by a few things:
Transaction data: any zero byte of data costs 4 gas for example, and any non-zero byte costs 68 gas.
I guess it depends on the amounts users should deposit.
1 Ether is 1000000000000000000 weis. So if users are supposed to deposit 1 Eth, it means you have plenty of "unused" zeros to use as markers - you could for example use 10 right-most zeros as markers which would give you plenty of unique IDs.
But if users are supposed to deposit for example ...
All of the data for an Ethereum transaction is stored in the block it was mined in. This means that a contract's data is also stored in the block.
The transaction ID is needed in order to look up the specific transaction data in that block.
In your case, a client can connect to the blockchain and search a block with the transaction ID. They will then be able ...