How to detect refund for paid app?

I noticed a very weird behavior for refunds. When a user refunds an up-front paid app, they still have access to the app. How can I detect such a case and block access to the app?

In general, I think it should be handled by Apple, but for some reason, they don't do it.

How to detect refund for paid app?
 
 
Q