Open Appstore in app not installed in device

In my application i have implemented DeepLink, now i am scanning one DeepLink url QR code via camera and url is opening in safari now i want to check if app is not installed user should redirect to Appstore. Right now it redirect me to safari browser after scan. how can we check it ? do we need to add anything on server side. (I have added apple-app-site-association file to server side).

Thanks in advance

Open Appstore in app not installed in device
 
 
Q