Apple summarizes the whole flow of server-side In App Purchases in this graph. It’s a very good starting point to get the overall idea what it necessary.
- GET available product identifiers
- POST the iTunes transaction receipt for validation and retrieve redeem code as response
That’s pretty much it.