lbryio / proposals

Discussion of large projects
1 stars 0 forks source link

Instant Verification - Google Play Billing #15

Closed akinwale closed 3 years ago

akinwale commented 3 years ago

After a user provides their email for verification in the mobile flow, we can implement a system for instant verification using Google Play Billing. We charge the user a specified amount using an in-app purchase (IAP) product. For IAPs, Google gets a 30% cut, while LBRY Inc. gets 70%.

Once a user completes a successful payment, the app will send a purchase token (uniquely generated for each purchase - https://developer.android.com/google/play/billing/integrate#launch) to internal-apis with the user's auth token in order to associate the purchase with the user.

We can use the Subscriptions and In-App Purchases API (https://developer.android.com/google/play/developer-api#subscriptions_api_overview) to check the status of the purchase (purchaseState - https://developers.google.com/android-publisher/api-ref/purchases/products/get). If the purchase status is successful, the user can be set to verified.

There is a 48-hour window for users to request an instant refund for in-app purchases (https://support.google.com/googleplay/answer/2479637?hl=en). In order to prevent refund abuse, a cron job can check the purchase status for purchases that are less than 48 hours old, and revoke verified status if any of the corresponding purchases have been refunded.