IPN unique identifier

cawecoy
Contributor
Contributor

Hi.

 

I thought txn_id was the IPN unique identifier, but it might be the transaction unique ID. I discovered that when the buyer purchases a product, then requests a refund through PayPal Resolution Center, and the seller approves the refund. In such case, I receive two different IPNs with same txn_id, one with payment_status = Reversed and other with payment_status = Canceled_Reversal.

 

I need an unique ID for each unique IPN, so I can avoid to process it more than once in case PayPal sends me twice for any reason. Maybe txn_id + payment_status + reason_code?

Login to Me Too
1 REPLY 1

cawecoy
Contributor
Contributor

OK, I decided to change what I save in database.

 

Now I am saving each transaction instead of each IPN, so the table's name changed from paypal_ipns to paypal_transactions. Then I am going to have only one row for those two IPNs with the same txn_id, which is going to be inserted in the table when I receive the first IPN (the one with payment_status = Reversed), and it is going to be updated when I receive the second IPN (the one with payment_status = Canceled_Reversal).

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.