Paypal IPN check if payment is onhold

I have an PayPal IPN which is working good. If somebody buys a product on my homepage, he gets an email with the product key. So far so good. But now I have a problem. Sometimes the payment is onhold and not available directly. The problem was often, that people bought a product and charged back the money then. I lost the product key (yes, i needed to invest for this) and the money + i need to pay the fees..

But I have an idea. If there would be a variable to check if the payment is successful and I have the money, or if it is holding by paypal, I could make a script. If it is onhold, the productkey gets deleted from the database and gets safed in another database with the variable


Then, if the money is on my account, the IPN should get triggered again, right? Then I just ask if there is an existing entry with the parent_txn_id and if yes, then I send the content of the other database, instead of the main database. I know it sounds confusing but everytime, if there is some action on my paypal account the IPN should get triggered, right? So I could check for the parent_txn_id.

For now I using this variables:

if (strcmp($readresp, "VERIFIED") == 0) {


I found the variable "payment_status". There are the values "COMPLETED" and "PENDING". Is PENDING the variable I need to use? I looked into the possible pending_reason´s, but there is no reason called "Holding because paypal´s protection"..

SO how to check if the money is onhold or successfully on my account?

Thank you :)

2 answers

  • answered 2018-03-14 01:47 Seif Hatem

    Yes "PENDING" is the status for any transaction that is being held for any reason

    anyways you don't want to send the product key unless the status is "COMPLETED" so just send the product key if it's COMPLETED

  • answered 2018-03-14 06:38 pp_haikal

    If you setup IPN, you should received an IPN with payment_status="PENDING" if the payment is on "hold" When the status "PENDING" present. the variable "pending_reason" should be included as well.

    You can refer here: