Question

I am currently working on some PayPal code and I have an issue where DoExpressCheckoutPayment doesn't seem to be returning a value for PAYMENTINFO_0_PAYMENTSTATUS on occasion.

Currently we are only checking to see if PAYMENTINFO_0_PAYMENTSTATUS is set to Completed but i'm not sure if there have been a few occasions where the status has been different.

If anyone knows what the issue could be or how to debug it that would be great.

Was it helpful?

Solution

The first thing I would do is start logging your API requests and responses so that you can refer to them when things like this happen and see exactly what did (or didn't) come back in the PayPal response. You could do this by saving files to the disk, emailing yourself, saving to a database table, or whatever you like to do for that sort of thing.

There are quite a few different things that could cause various values for payment status. Fraud filters, e-checks, PayPal holding policies, etc.

If you haven't already, I would recommend utilizing Instant Payment Notification (IPN) as well. It will POST transaction data to a script you have setup to process the data accordingly. It happens in real-time, so it can be used as sort of an additional layer of data validation. IPN will include a payment_status parameter as well, so you can start seeing different values and comparing to API responses in order to get your code logic exactly where it needs to be.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top