Hi,
I am working on integrating PaylPal as a payment module in my webshop. I use PHP and Mysql. After a payment has been made with PayPal the customer is redirected to my webshop. At that time my IPN en DPT scripts are called simultaniously. I do that because sometimes IPN has a (tiny) delay. I don't want my customer to wait for the IPN, so the PDT script then takes care of processing the order and makes an insert into the database. Ofcourse before the insert the PDT script checks the order with a postback.
When the 2 scripts are called simultaniously there is a danger that the order is processed twice. We don't want that. So I made the column for the txn_id field a unique column. If the query fails for IPN, DPT already made the insert into the database and vice versa. That way I don't have to lock any tables.
Am I right doing this?