1 Currently using version 3.0, supporting managed and subscription.
2 Managed products support consumption, can be repurchased after consumption, and can also be used for one-time purchases. Handle the logic in your own code. Subscriptions are used for monthly or yearly subscriptions.
3 First, upload the signed APK to Google, create managed products and subscriptions, set prices, descriptions, and other information.
4 In the publishing console, set up test accounts. The test account cannot be the same as the published account, otherwise it cannot be purchased.
5 Obtain the public key of this APK from the APK publishing console and paste it into security.java in the APK.
6 Rebuild and upload the signed APK to the publishing console, and run the APK that has been signed with the same publishing certificate to test successfully. Otherwise, an error will occur: "this version of the application is not enabled for in-app billing."
7 Security recommendation: Do not display your public key in plaintext in the APK. At least encrypt it or obtain it from your server. Use payload to verify the responses during the purchase process to avoid man-in-the-middle attacks.