chargebee_flutter 0.0.1 copy "chargebee_flutter: ^0.0.1" to clipboard
chargebee_flutter: ^0.0.1 copied to clipboard

outdated

This is the official Software Development Kit (SDK) for Chargebee Flutter.

Chargebee Flutter #

This is Chargebee’s Flutter Software Development Kit (SDK). This SDK makes it efficient and comfortable to build a seamless subscription experience in your Flutter app.

Requirements #

The following requirements must be set up before installing Chargebee’s Flutter SDK.

Installation #

The Chargebee-Flutter-SDK SDK can be installed by adding below dependency to the pubspec.yaml file:

dependencies:
  chargebee_flutter: ^1.0.0

Example project #

This is an optional step that helps you verify the SDK implementation using this example project. You can download or clone the example project via GitHub.

To run the example project, follow these steps.

  1. Clone the repo - https://github.com/chargebee/chargebee-android.

  2. Run build.gradle from the Example directory.

Configuration #

  • Configuration for In-App Purchases

Configuration for In-App Purchases #

To configure the Chargebee Flutter SDK for completing and managing In-App Purchases, follow these steps.

  1. Integrate Google Play Store with your Chargebee site.

  2. On the Sync Overview page of the web app, click Set up notifications and use the generated App ID value as SDK Key.

  3. On the Chargebee site, navigate to Settings > Configure Chargebee > API Keys to create a new Publishable API Key or use an existing Publishable API Key. Note: During the publishable API key creation you must allow read-only access to plans/items otherwise this key will not work in the following step. Read more.

  4. Initialize the SDK with your Chargebee site, Publishable API Key, and SDK Key by including the following snippets in your app delegate during app startup.

import 'package:chargebee_flutter/chargebee_flutter.dart';

Chargebee.configure(site: "your-site", apiKey: "publishable_api_key", sdkKey: "ResourceID/SDK Key")

Integrating In-App Purchases #

The following section describes how to use the SDK to integrate In-App Purchase information. For details on In-App Purchase, read more here.

Get IAP Products #

Retrieve the Google IAP Product using the following function.

try {
  List<Object?> result = await Chargebee.retrieveProducts({productList: "[Product ID's from Google Play Console]"});
} catch (e) {
  print(e);
}
            

You can present any of the above products to your users for them to purchase.

Buy or Subscribe Product #

Pass the product and customer identifiers to the following function when the user chooses the product to purchase.

customerId - Optional parameter. We need the unique ID of your customer as customerId. If your unique list of customers is maintained in your database or a third-party system, send us the unique ID from that source.

try {
  final result = await Chargebee.purchaseProduct(product, customerId);
}  catch (e) {
  print('Exception : $e');
}

The above function will handle the purchase against Google Play Store and send the IAP token for server-side token verification to your Chargebee account. Use the Subscription ID returned by the above function, to check for Subscription status on Chargebee and confirm the access - granted or denied.

Get Subscription Status for Existing Subscribers #

The following are methods for checking the subscription status of a subscriber who already purchased the product.

Get Subscription Status for Existing Subscribers using Query Parameters #

Use query parameters - Customer ID for checking the Subscription status on Chargebee and confirm the access - granted or denied.

try {
  List<dynamic> subscriptionList = await Chargebee.retrieveSubscriptions(customerId);
}  catch (e) {
  print('Exception : $e');
}  

For example, query parameters can be passed as "customer_id" : "id".

License #

Chargebee is available under the MIT license. See the LICENSE file for more info.

6
likes
0
pub points
76%
popularity

Publisher

verified publisherchargebee.com

This is the official Software Development Kit (SDK) for Chargebee Flutter.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

collection, flutter, json_annotation, progress_dialog_null_safe

More

Packages that depend on chargebee_flutter