Join us at Adapty Conf in Warsaw on June 13, 2024.
Secure your spot for free!
Glossary

Server Receipt Validation

Server Receipt Validation

Sergey Zubkov

Updated: July 27, 2023

3 min read

Content

Server Receipt Validation 

Server validation, also known as server-side receipt validation, is a process used to ensure that purchases made within an app are authentic. This is achieved by using an encrypted file, in PKCS#7 format, which contains information about all in-app purchases.

To authenticate purchased content, you can include receipt validation code in your app or server. App Store receipt validation involves sending a request to Apple’s servers to verify the purchase and determine whether it was valid. This is particularly important for auto-renewable subscriptions as you need to know when they expire in order to provide or block access to your content. Receipt validation is also used when users need to restore a purchase, such as when they reinstall your app.

After each transaction, a receipt is issued by Apple, which is stored locally on the device. However, there are three ways to validate it: local validation using OpenSSL, validation through Apple from an iOS device, or validation through Apple using your own server. While the first method is more complex and requires integrating the OpenSSL library into your application, it’s the other two methods that are safer and more reliable. Validating receipts on the device can be unsafe, as there’s a risk of interception of your requests.

Why do you need receipt validation

While server validation is not compulsory, it offers several benefits. One of these is advanced payment analytics, which is particularly crucial for subscriptions since any activity after activation is not processed by the device. Without server purchase processing, it would be impossible to determine the current subscription status, whether the user has renewed or canceled it, or if there are any billing issues.

Receipt validation is an essential way of preventing fraudulent in-app purchases in the iOS and Android app stores. Many people attempt to make in-app purchases using fake receipts, but App Store receipt validation can prevent this.

Another benefit of server validation is cross-platform subscriptions. By checking a user’s subscription status in real-time, you can synchronize it with other platforms. For example, if a user purchases a subscription from an iOS device, they can use it on Android, the web, and other platforms.

Furthermore, server-side content access control protects against users who try to access data without a subscription by merely executing requests to the server.