* The In-app product id should format: <package_id>_<type>_<number>. Ex: com.app.habitapp_yearly_000 (desc: Annual Subscription, Subscription Display Name: One year subscription, Description: Аll features of the app are available to you)
* The In-app product just works on real device
— — — — — — —
Mobile site
libs
# in app purchase
flutter_inapp_purchase:
git:
url: https://github.com/nhancv/flutter_inapp_purchase.git
in_app_purchase: ^0.3.4+16
shared_preferences: ^0.5.12+4
iOS
- Setup your in app products for ios in itunesconnect.
+ You need to complete the Agreements, Tax and Bankings.
+ Add In-App Purchases in Features tab. Check that your product’s status is Ready to Submit.
- Check your xcode setting and make In-App Purchase available.
Android
- Add billing permission Android manifest
<uses-permission android:name="com.android.vending.BILLING" />
* The importance to debug purchases on android is use release signingConfig in debug build type. Google Play Billing APIs only works with apps signed for production.
buildTypes {
debug {
debuggable true
signingConfig signingConfigs.release
}
release {
signingConfig signingConfigs.release
......
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
* Update `android/app/proguard-rules.pro`
#In app Purchase
-keep class com.amazon.** {*;}
-keep class com.dooboolab.** { *; }
-keep class com.android.vending.billing.**
-dontwarn com.amazon.**
-keepattributes *Annotation*
- Setup your in-app purchases for android in playstore.
+ Create new app
+ You need to upload apk with billing permission and set up merchant account before creating in-app product.
+ Monetize -> Products -> Subscriptions -> Create subscription -> Active
* Android sandbox test:
https://developer.android.com/google/play/billing/billing_testing.html#billing-testing-test
https://medium.com/bleeding-edge/testing-in-app-purchases-on-android-a6de74f78878
In order to be eligible for test purchases, there are a few steps to go through:
- Your APK must be uploaded to the Play Console (drafts are no longer supported)
- Add license testers in the Play Console: https://support.google.com/googleplay/android-developer/answer/6062777
+ Play Console -> Settigns -> License testing -> Add tester gmail address + License response = RESPONSE_NORMALLY -> Save
- Have testers join the alpha/beta testing group (if available)
- Wait the app store update before testing: 2-4 days or more (ex: in covid19, maybe up to 2wks) to live on App Store in the first time (you will get the result email after reviewed. Remember: review apply for production and internal testing as well), then 1-2 hours to live
FREE TRIAL SUBSCRIPTION CONFIG
Docs:
https://pugpig.zendesk.com/hc/en-us/articles/360015374971-Setting-Up-Free-Trial-Subscriptions
Google play:
https://support.google.com/googleplay/android-developer/answer/140504?hl=en
App store connect
———————
Refs:
– https://medium.com/codechai/flutter-in-app-purchase-7a3fb9345e2a
– https://pub.dev/packages/flutter_inapp_purchase/example
– https://developer.apple.com/forums/thread/117803
The sandbox should issue 5 renewals of an auto renewable subscription to any test user and then stop issuing any further auto renewals to that test user.
– https://medium.com/bleeding-edge/testing-in-app-purchases-on-android-a6de74f78878
– https://medium.com/flutter-community/how-to-set-up-in-app-purchases-in-apple-connect-and-google-play-console-28cc2456af3b
@nhancv