Search code examples
firebase-realtime-databasein-app-purchasein-app-billing

Verify In-App Purchases with Firebase Realtime Database


I'm trying to integrate in-app purchases into my app using Firebase Realtime database to verify/save records for the purchases. The problem is when I try to verify a purchase from client to back end server (Cloud functions) to check whether the key/purchaseToken already exist. But since Realtime Database can't store paths that contain "." (dot), how can I store and verify this information?

I think I can strip the dots from the strings but I don't know if that's the right way to do it.

Source: https://developer.android.com/google/play/billing/security#verify


Solution

  • If you have a key that contains characters that are not allowed (such as a .), then I typically encoded that character either with something else (e.g. it is common to replace the . in an email address with a , in RTDB keys), or with a generic URL encoding.