Designing subscriptions with Play Billing

Mobile system design Senior Kotlin 2.0+ API 24+ Reviewed By Best Latest Apps

Order the steps

Order a subscription purchase flow.

  • Query product details and show the offer
  • Send the purchase token to your server
  • Acknowledge the purchase
  • Server verifies with the Play Developer API and grants access
  • Launch the billing flow

Choose an answer, then open Show answer below to check it.

Show answer

Answer: A E B D C

  1. Query product details and show the offer From the Billing Library.
  2. Launch the billing flow Play handles payment.
  3. Send the purchase token to your server Not trusted locally.
  4. Server verifies with the Play Developer API and grants access Server is the source of truth.
  5. Acknowledge the purchase Within three days.

30-second answer

Use the Play Billing Library to show products and launch purchases, but treat your server as the source of truth. Send the purchase token to your backend, verify it with the Google Play Developer API, grant access, and acknowledge the purchase within three days or Google refunds it. Listen to Real-time Developer Notifications for renewals, cancellations and grace periods.

Practise saying it · 35 s. No recording, just a timer

Explain subscription handling.

Say your answer out loud, then check which of these points you covered:

  • Billing Library for UI
  • Server verifies tokens
  • Acknowledge in 3 days
  • RTDN for lifecycle
  • Restore on start

Deep dive

Query purchases on app start to restore access on new devices.

Handle pending purchases; some payment methods complete later.

Grace period and account hold mean access rules depend on state.

Link purchases to your user account with obfuscated account IDs.

Common mistakes

  • Granting access from the client alone.
  • Forgetting to acknowledge purchases.
  • Ignoring renewal and cancellation notifications.

Senior take & follow-ups

Server as source of truth, token verification, acknowledgement, RTDN.

Follow-up questions

Think of your answer first, then open the hint.

  1. What happens if you don't acknowledge?

    Show hint

    Play refunds the purchase after three days.

  2. Why server verification?

    Show hint

    Clients can be tampered with; the server checks with Google.

Similar on iOS: In-app purchases with StoreKit 2 StoreKit 2 verifies transactions on device as well; Play relies on your server.

Suggest a fix if something here is wrong or out of date.