I'm using PDT, when the payment_status is Completed, I update my database and exchange the amount to credit. For example, 30 USD to 30 minutes of service.
I worry that someone make a payment and with payment_status pending, in that case my application would not perform this exchange. So, what will happen when payment is finally completed?
On the other hand, what if my application will meterito falls and can not process a payment made in PayPal, there's some way to tell PayPal "Hey, I've already process the payment, save it"?
Thanks.
Use IPN, which is very similar to PDT, except that PayPal's server just POSTs the data to a listener URL that you provide as opposed to your return URL.
IPNs will be triggered with every PayPal transaction regardless of whether the user makes it back to your return URL (which is another reason to use it instead of PDT in the first place).
In the case of a payment that is initially pending, you'll get an IPN with a payment_status of pending, so you can update your database and send out email notifications accordingly.
When the payment clears (or fails) you'll get another IPN with the same txn_id, but a new payment_status, so then your IPN script can act accordingly.