views:

40

answers:

0

I was thinking how to treat the payment status in my database. I want to store all payments in my database (also the pending ones). But we have to check in the IPN process if there is already a payment with such txn_id, right?

Let's suppose I receive a payment that is pending and I store it on my database.

After that, when the payment is completed I'll receive a IPN communicating that the payment has been completed, right? Now here is the problem: I already stored the payment as pending on my database, how to check if an account has not been created yet for this payment? (My website will automatically create accounts for who buys my product).

I consider just creating accounts for the payments which are with status Completed, so we will not create an account for the pending payments and later on, when the payments are completed, then the new IPN is sent with status Complete and account is created (and I update txn status on my database). Is that solution that I mentioned completely correct? If I do this wouldn't I be in danger considering frauds? Is there any other condition that can happen and for that my solution will not work?

Please could someone explain me it better and eventually mention any more "fraudless" solution?

Thank you