To test in app purchases, you will need to set up test users in iTunes Connect.
They seem to almost work like real Apple IDs, so you should have unique email addresses for them. [email protected] seems to work. You cannot use them in the real App Store, but only can use them within sandbox-signed development apps.
Don’t log in to the test accounts in the real App Store or in the Settings app. Log out in Settings, then attempt the purchase in your app. There, enter the fake email address and password.
The sandbox server does not guarantee an eternal backlog of transactions. I at least once noticed very old receipts just being blank when restored.
Sometimes, test users will burn and stop working. Just create a new test user and try again.
Test with different countries and make sure the app is flexible enough to accomodate for very long currency strings. Or prepare for the App Store to return bogus price locales (such as today) or nil values for titles or descriptions.