Skip to content

Navideck/purchases_dart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PurchasesDart

PurchasesDart is a Dart implementation of the purchases_flutter plugin, designed to facilitate in-app purchases and subscriptions using Web Billing. The purchases_dart package closely follows the native APIs of purchases_flutter.

Usage

Configure

Before using PurchasesDart, you need to configure it with PurchasesDartConfiguration. This configuration requires a Web Billing API key and a user ID (you can use your auth system to generate a consistent user ID).

await PurchasesDart.configure(
  PurchasesDartConfiguration(
    apiKey: WEB_BILLING_API_KEY,
    appUserId: userId,
  ),
);

Get customer info

await PurchasesDart.getCustomerInfo();

Get offerings

await PurchasesDart.getOfferings();

Purchase package

Make sure the Web Billing URL is configured for the package in your RevenueCat dashboard.

Then, retrieve the Web Billing URL using:

await PurchasesDart.getWebBillingUrl(package);

Launch the URL in a browser using url_launcher.

To return to the app:

  • Set a success page URL in your Web Billing configuration that can open your app via deep link.
  • Use app_links to handle deep links in your app.

Important Notes

It’s crucial to use a consistent appUserId with PurchasesDart. Using an anonymous user ID is not recommended, as there’s currently no way to restore purchases for anonymous users if the app is uninstalled.

About

A pure Dart implementation of the purchases_flutter plugin (aka RevenueCat)

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •