开发者

PayPal: IPN and PDT scripts working together and simultaniously

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 t开发者_StackOverflow中文版hen 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?


I'm not a pro, and trying out these things myself at the moment. But from what I have read so far, I think this is a good way to do it.

What you might want to is to have the IPN and PDT data fill each other out a bit. Because even though the PDT is done first, I think you can get more data through the IPN. How to do that best I am not quite sure about however. And it of course also depends on what exactly you want of the data and what you need to use it for.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜