What exact "error" did you get? Did you mention the error when you spoke with somebody at Apple? Contact Apple Support - Apple Support
Contact the developer. They are the ones responsible for ensuring you get the item you have requested. However, your mention of some unknown "error" make me wonder if your purchase was not completed properly. In that case you really need to actually speak with somebody at Apple. They make mention of an automated system when processing refund requests (https://reportaproblem.apple.com/static/en-us/privacy.html) and you situation may need something, uh, smarter than that.
Click on this link to learn how to contact an app developer about problems running an app or problems restoring purchases. --> How to contact an app developer - Apple Support
Apple's terms of purchase in the USA are, "All Transactions are final," ( Legal - Apple Media Services - Apple section B), but check the terms for your country. For other countries' terms I have read they say refunds are made to remedy defective or unavailable product.