Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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+

Expand All @@ -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.
Expand Down Expand Up @@ -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','','','');
Expand Down
17 changes: 9 additions & 8 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -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"
}
}
Expand All @@ -30,7 +31,7 @@ android {
namespace 'com.chargebee.flutter.sdk'
}

compileSdkVersion 30
compileSdkVersion 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -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'
}
1 change: 1 addition & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
org.gradle.jvmargs=-Xmx2048m
android.useAndroidX=true
android.enableJetifier=true
android.experimental.lint.version=8.13.0
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ if (flutterVersionName == null) {

def flutterMinSdkVersion = localProperties.getProperty('flutter.minSdkVersion')
if (flutterMinSdkVersion == null) {
flutterMinSdkVersion = '21'
flutterMinSdkVersion = '23'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 33
compileSdkVersion 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -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
}
Expand All @@ -73,5 +73,5 @@ flutter {
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
5 changes: 3 additions & 2 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -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"
}
}
Expand Down
3 changes: 3 additions & 0 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -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


2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion ios/chargebee_flutter.podspec
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
7 changes: 7 additions & 0 deletions lib/src/chargebee.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<List<CBRestoreSubscription>> restorePurchases([
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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'

Expand Down
Loading