All case studies

Subscriptions

Paid content for paid subscriptions only

A mobile app sold a subscription, and its server could not tell whether the subscription was really paid.

  • Subscriptions
  • Mobile apps
  • Backend

Under NDA

The company’s name and logo are under NDA. We left out the details that could identify it.


Store
the store is asked about every purchase
Signature
an unsigned token is refused without a call to the store
Failures
a store failure closes access and raises an alert

The problem

The app sold subscriptions through the App Store and Google Play. The server handing out paid content had no way to check a purchase with the store.


What we did


  1. 01The proof of purchase became part of the contract the app and the server share: the app sends it with every request for paid content.

  2. 02The App Store’s signed transaction is checked against Apple’s certificate chain, and only then does the server ask Apple for the subscription’s status.

  3. 03Google Play is asked about every token. A canceled subscription that is already paid for stays open to the end of its period.

  4. 04Each environment names the stores it checks, and a config check bars the test stand-in from the live environment. Tokens never reach logs or metrics.

Result

Paid content opens only for a subscription the store has confirmed. Test purchases from TestFlight and Google Play license testers work in the live environment too.


Technologies

  • Kotlin
  • Ktor
  • App Store Server API
  • Google Play Developer API

Have a similar problem?

Write to us about what is going on. We reply within 2 business days.

Write to us


More case studies