Implementing Facebook pixel

I need an help in implementing facebook pixel.
I have setup a basic html store. The pixel respond well to page view and purchase completion. The payment is made with stripe that redirect to my thank you page when the payment is completed. The pixel is set that the thank you page trigger the completion of the transaction. The problem is that simply refreshing that page or navigate directly to that web page and another 'purchase' event is triggered.

How to avoid this and make it safe?