diff --git a/.github/workflows/ci-checks.yml b/.github/workflows/ci-checks.yml index aba42c2..da8e5d4 100644 --- a/.github/workflows/ci-checks.yml +++ b/.github/workflows/ci-checks.yml @@ -14,10 +14,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: set up JDK 11 + - name: set up JDK 17 uses: actions/setup-java@v1 with: - java-version: 11 + java-version: 17 - name: Setup Flutter Environment uses: subosito/flutter-action@v1 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e65ecc..a175a34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## 1.0.0-beta.11 +Chore +* Include latest chargebee-android (`2.0.0-beta-6`) with upgraded billing client lib to v8.3.0 +* Android compile/target SDK version raised to 34 +* Kotlin 2.1.21, AGP 7.4.2, Gradle 7.6.4, JDK 17 + +Breaking +* Android minimum SDK version raised from 21 to 23 (required by Google Play Billing Library 8) +* On Android, `restorePurchases` no longer returns fully expired subscriptions, even when `includeInactivePurchases` is true. Google Play Billing 8 removed the purchase history API and offers no client-side replacement, so only active subscriptions can be restored, including those that are cancelled but not yet expired, paused, in trial, or suspended. iOS is unaffected. + ## 1.0.0-beta.10 Feature * Adds 'offerPrice' to return Introductory price for Apple diff --git a/README.md b/README.md index 382bd80..7b81d7b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ > [!NOTE] > #### Updates for Billing Library 5 -> - SDK Version 1.0: This version includes Google Billing Library 7.1.1 but uses Google Billing Library 5.2.1 APIs to fetch product information from the Google Play Console and make purchases. If you’re integrating Chargebee’s SDK for the first time, then use this version, and if you’re migrating from the older version of SDK to this version, follow the migration steps in this [document](https://www.chargebee.com/docs/2.0/mobile-playstore-billing-library-5.html). +> - SDK Version 1.0: This version includes Google Billing Library 8.3.0 but uses Google Billing Library 5.2.1 APIs to fetch product information from the Google Play Console and make purchases. If you’re integrating Chargebee’s SDK for the first time, then use this version, and if you’re migrating from the older version of SDK to this version, follow the migration steps in this [document](https://www.chargebee.com/docs/2.0/mobile-playstore-billing-library-5.html). > - SDK Version 0.4.0: This [version](https://github.com/chargebee/chargebee-flutter/tree/main) includes Billing Library 5.2.1 but still uses Billing Library 4.0 APIs to fetch product information from the Google Play Console and make purchases. This will enable you to list or update your Android app on the store without any warnings from Google and give you enough time to migrate to version 2.0. Chargebee's Flutter SDK enables you to build a seamless and efficient customer experience for your subscription business. @@ -17,10 +17,11 @@ The following requirements must be set up before installing Chargebee's Flutter - Flutter version 2.10.0 and above - Dart SDK version 2.16.2 and above -- [Android Gradle Plugin](https://developer.android.com/studio/releases/gradle-plugin "https://developer.android.com/studio/releases/gradle-plugin") 4.0.0 -- [Gradle](https://gradle.org/releases/ "https://gradle.org/releases/") 6.1.1+ +- [Android Gradle Plugin](https://developer.android.com/studio/releases/gradle-plugin "https://developer.android.com/studio/releases/gradle-plugin") 7.4.2+ (AGP 8.10+ recommended; on AGP 7.4.x add `classpath 'com.android.tools:r8:8.10.21'` before AGP so D8 can dex Billing Library 8 / Kotlin 2.2) +- [Gradle](https://gradle.org/releases/ "https://gradle.org/releases/") 7.6.3+ +- Android minimum SDK version 23, compile and target SDK version 34 - [AndroidX](https://developer.android.com/jetpack/androidx/ "https://developer.android.com/jetpack/androidx/") -- Java 8+ and Kotlin +- JDK 17 and Kotlin 2.0+ - iOS 12+ - Swift 5+ @@ -32,7 +33,7 @@ To use Chargebee SDK in your Flutter app, follow these steps: ``` dart dependencies: - chargebee_flutter: ^1.0.0-beta.10 + chargebee_flutter: ^1.0.0-beta.11 ``` 2. Install dependency. @@ -158,6 +159,9 @@ The `restorePurchases()` function helps to recover your app user's previous purc To retrieve **inactive** purchases along with the **active** purchases for your app user, you can call the `restorePurchases()` function with the `includeInactivePurchases` parameter set to true. If you only want to restore active subscriptions, set the parameter to false. Here is an example of how to use the restorePurchases() function in your code with the `includeInactivePurchases` parameter set to true. +> [!IMPORTANT] +> `restorePurchases()` restores subscriptions only; one-time products are never restored. On Android, Google Play Billing Library 8 removed the purchase history API and provides no client-side replacement, so only subscriptions that Google Play still associates with the user's account can be restored: active ones, including those that are cancelled but not yet expired, paused, in trial, or suspended. Subscriptions that have fully expired are no longer returned, even when `includeInactivePurchases` is set to `true`. iOS is unaffected. + ``` dart try { final customer = CBCustomer('id','','',''); diff --git a/android/build.gradle b/android/build.gradle index 89b5146..370b8ad 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,15 +1,16 @@ group 'com.chargebee.flutter.sdk' -version '1.0.0-beta.10' +version '1.0.0-beta.11' buildscript { - ext.kotlin_version = '1.6.0' + ext.kotlin_version = '2.1.21' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools:r8:8.10.21' + classpath 'com.android.tools.build:gradle:7.4.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -30,7 +31,7 @@ android { namespace 'com.chargebee.flutter.sdk' } - compileSdkVersion 30 + compileSdkVersion 34 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 @@ -46,13 +47,13 @@ android { } defaultConfig { - minSdkVersion 21 + minSdkVersion 23 } } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'com.chargebee:chargebee-android:2.0.0-beta-5' + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'com.chargebee:chargebee-android:2.0.0-beta-6' implementation 'com.google.code.gson:gson:2.8.6' - implementation 'com.android.billingclient:billing-ktx:7.1.1' + implementation 'com.android.billingclient:billing-ktx:8.3.0' } diff --git a/android/gradle.properties b/android/gradle.properties index ff5389f..a1da9ac 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,3 +1,4 @@ org.gradle.jvmargs=-Xmx2048m android.useAndroidX=true android.enableJetifier=true +android.experimental.lint.version=8.13.0 diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 186b715..763217c 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 9244484..25d5246 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -23,7 +23,7 @@ if (flutterVersionName == null) { def flutterMinSdkVersion = localProperties.getProperty('flutter.minSdkVersion') if (flutterMinSdkVersion == null) { - flutterMinSdkVersion = '21' + flutterMinSdkVersion = '23' } apply plugin: 'com.android.application' @@ -31,7 +31,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 33 + compileSdkVersion 34 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 @@ -50,7 +50,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.chargebee.example" minSdkVersion flutterMinSdkVersion - targetSdkVersion 33 + targetSdkVersion 34 versionCode flutterVersionCode.toInteger() versionName flutterVersionName } @@ -73,5 +73,5 @@ flutter { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } diff --git a/example/android/build.gradle b/example/android/build.gradle index 8c127a1..b7cfd74 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,12 +1,13 @@ buildscript { - ext.kotlin_version = '1.8.10' + ext.kotlin_version = '2.1.21' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.0' + classpath 'com.android.tools:r8:8.10.21' + classpath 'com.android.tools.build:gradle:7.4.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/example/android/gradle.properties b/example/android/gradle.properties index f2a5dbf..cd5a85e 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1,5 +1,8 @@ org.gradle.jvmargs=-Xmx1536M --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED android.useAndroidX=true android.enableJetifier=true +# Lint bundled with AGP 7.4.2 uses Kotlin 1.7 and cannot read the Kotlin 2.2 +# metadata in billing-ktx 8.3.0 and its kotlin-stdlib. Lint 8.13.0 ships Kotlin 2.2. +android.experimental.lint.version=8.13.0 diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index bfd9890..b027681 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip diff --git a/ios/chargebee_flutter.podspec b/ios/chargebee_flutter.podspec index 3ba2db1..44c7f56 100644 --- a/ios/chargebee_flutter.podspec +++ b/ios/chargebee_flutter.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'chargebee_flutter' - s.version = '1.0.0-beta.10' + s.version = '1.0.0-beta.11' s.summary = 'This is the official Software Development Kit (SDK) for Chargebee Flutter.' s.description = <<-DESC A new Flutter plugin. diff --git a/lib/src/chargebee.dart b/lib/src/chargebee.dart index 38ca7bd..09badf7 100644 --- a/lib/src/chargebee.dart +++ b/lib/src/chargebee.dart @@ -287,6 +287,13 @@ class Chargebee { /// /// [bool] includeInactivePurchases When set to true, the inactive purchases are also synced to Chargebee. /// + /// Subscriptions only; one-time products are never restored. On Android, Google + /// Play Billing 8 removed the purchase history API, so only subscriptions that + /// Google Play still associates with the account can be restored: active ones, + /// including those that are cancelled but not yet expired, paused, in trial, or + /// suspended. Subscriptions that have fully expired are not returned even when + /// [includeInactivePurchases] is true. iOS is unaffected. + /// /// The list of [CBRestoreSubscription] object be returned. /// Throws an [PlatformException] in case of failure. static Future> restorePurchases([ diff --git a/pubspec.yaml b/pubspec.yaml index 058f73c..ce3f5af 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: chargebee_flutter description: This is the official Software Development Kit (SDK) for Chargebee Flutter. -version: 1.0.0-beta.10 +version: 1.0.0-beta.11 homepage: 'https://chargebee.com' repository: 'https://github.com/chargebee/chargebee-flutter'