I think the basic idea here is a URL Scheme that you need to create. When a user does the actions necessary to open your app send them to this URL -> which opens your app or takes them to the app store to purchase your app.
Do a quick google search on how to create a URL scheme, its quite simple.
Does this answer your question?