Skip to main content

daybook_subscriptions 0.10.1 copy "daybook_subscriptions: ^0.10.1" to clipboard
daybook_subscriptions: ^0.10.1 copied to clipboard

Purchases for Flutter on Daybook: StoreKit 2 and Google Play Billing subscriptions that are never lost, access you can check, and paywalls as data.

0.10.1 #

  • For a customer the app signed in, what the store already holds is sent to Daybook once: at the launch that knows the customer, and right after identify (PM-B-0308). A subscription bought with another SDK, such as Adapty, and finished or acknowledged there used to reach Daybook only through restorePurchases, so an app moving off that SDK showed such a subscriber no access until they restored. Now Daybook holds it at the first launch, and profileUpdates tells the profile it brings.
  • On iOS, StoreKit's current entitlements are read as they stand, without AppStore.sync(): nobody is asked for their Apple ID. On Android, the subscriptions Google Play lists acknowledged; the unacknowledged ones and one-time purchases were reported at launch already.
  • Each purchase goes once per customer. One that cannot be sent is asked of the store again at the next launch, not kept on disk. Nothing is finished or acknowledged again.
  • An anonymous install sends nothing it did not buy: under a Transfer policy the purchase would move to it.

0.10.0 #

Breaking. Purchases are now a module of Daybook (PM-R-0110): the app starts Daybook once, and this SDK is activated with it.

  • The app no longer calls activate. Add daybook beside daybook_subscriptions, call await Daybook.initialize('dbk_…') with the app's key from the console, and reach purchases as daybook.subscriptions. Finishing.manual is set with DaybookSubscriptions.configure(finishing:) before Daybook starts.
  • Sign a person in with daybook.identify(userId, email:, name:) and out with daybook.reset(). Every Daybook module hears it; the email and name are kept on the customer.
  • The install id is the core's, the same one analytics sends. An install that already has an id keeps it.
  • The activation and identify carry the id the person's analytics events are filed under, so a purchase made before sign-in is the same person in Analytics as the install's events.
  • The app's key, dbk_…, travels in X-Daybook-Key. A pms_… key still travels in X-Sdk-Key.
  • With Daybook out of reach at the first launch, the module is still there: the first call that needs a customer activates again.

0.9.0 #

  • Who the customer is: setAttributes, setEmail and setName write the install's own customer's email, name and the app's own attributes to Daybook (POST /subs/v1/attributes). A null removes a key; keys not named stay. The profile carries them as email, name and attributes, and is told on profileUpdates.
  • Limits, refused whole as validation_failed naming the limit: at most 50 of the app's own attributes, keys of up to 40 letters, digits and _, values of up to 500 characters, an email of up to 254.
  • A profile from a Daybook before attributes reads as none: email and name null, attributes empty.

0.8.0 #

  • One-time products on Google Play. An id with no base plan, such as lifetime_99, is a one-time product: getProducts, getPaywallProducts and makePurchase take it as they take productId:basePlanId. Its type is unknown, as Google does not say whether it is consumed.
  • A product Daybook's catalog declares Consumable is consumed once Daybook holds it, so it can be bought again; anything else is acknowledged. Finishing manually, finishTransaction does the same.
  • At every launch the one-time purchases Google Play still lists are reported, and restorePurchases reports them too.
  • While Daybook cannot be reached, a one-time purchase grants its level on the device as a lifetime one.

0.7.0 #

  • Plan changes on Google Play: makePurchase(product, replacing: SubscriptionReplacement(oldProductId, mode: …)) switches the account's subscription of oldProductId to product. The modes are Google's ReplacementMode: withTimeProration (the default), chargeProratedPrice, chargeFullPrice, withoutProration and deferred. The SDK finds the old purchase itself and asks Play Billing 9.1 for the change. A deferred change, which Play hands over under the old product until it takes effect, is reported all the same. iOS ignores replacing, as StoreKit changes plans within a subscription group itself.
  • A plan change carries the account ids the old purchase was bought with, as Play refuses any other, even when another SDK, such as Adapty, bought it.
  • New error code: subscription_not_found, when the account holds no subscription of oldProductId.

0.6.0 #

  • Android, on Google Play Billing 9.1 (minSdk 24), behind the same Dart API. Subscriptions only, so far.
  • A subscription is named by Google Play's product and base plan, productId:basePlanId, as Daybook's catalog and paywalls name it. getProducts gives its price and period, and as its intro offer the offer Google Play lets this buyer have, such as a free week.
  • makePurchase carries the customer's id as the purchase's obfuscated account id. A purchase is acknowledged only once Daybook holds it; until then its token waits on disk and is sent again with backoff, as on iOS. With finishing: Finishing.manual, finishTransaction acknowledges it. A purchase Daybook refuses is never acknowledged.
  • At every launch the subscriptions Google Play holds unacknowledged are reported; restorePurchases reports all of them.
  • getStorefront() gives Google Play's country, alpha-3 as on iOS (USA), with its alpha-2 code as the id.
  • Placements are asked for with store=play_store, so paywalls come by Google Play's ids. Bundle the Android fallback file: Subscriptions › Paywalls › Fallback file · Android.
  • While Daybook cannot be reached, what Google Play says the account owns is granted on the device, marked isLocal.

0.5.0 #

  • getStorefront() gives the App Store storefront the buyer is signed into: its country (USA, BLR) and id, or null when the App Store cannot say. Prices already follow it; copy, a highlighted product or an offer by country can now too.
  • Every getPlacement sends the storefront's country to Daybook, which takes it and does not read it yet, so paywalls by country can come later without an app release.

0.4.0 #

  • Paywalls. getPlacement(id) gives the placement's published paywall: its products in order, with the access level each unlocks, and its remote config for the device's language. It keeps the answer for when Daybook cannot be reached, and falls back to the file given to setFallback(asset). Paywall.source says which answered.
  • getPaywallProducts(paywall) gives the App Store's products for it, in its order, with their intro offers and the buyer's eligibility, and lists in missing any the App Store did not return.
  • A purchase of a paywall's product reports the paywall and its placement, also when it is sent again later. logShowPaywall(paywall) records a view.
  • A paywall's products teach offline access which level they unlock.
  • New error code: invalid_fallback.

0.3.0 #

  • Access keeps working when Daybook does not. While Daybook cannot be reached, the subscriptions and one-time purchases StoreKit holds are granted on the device, for the products Daybook has named to this install, and marked with AccessLevel.isLocal. Once Daybook answers again, its profile replaces the local one.
  • A purchase made while Daybook cannot be reached now succeeds with that local grant, and is reported once Daybook is back. A consumable, or a product Daybook has never named, still fails with the network error and waits.
  • Offline, a kept level whose expiry has passed reads inactive unless StoreKit still holds it. An unverified transaction is never granted on the device.

0.2.0 #

  • Purchases on StoreKit 2. getProducts gives the App Store's products with their price, type and period; makePurchase buys one and returns PurchaseSuccess with the profile, PurchaseUserCancelled or PurchasePending. Every purchase carries the customer's id as its appAccountToken.
  • From activate on, StoreKit's updates are reported to Daybook as they come, and what it left unfinished is reported at every launch. A Pending purchase that completes later reaches the app through profileUpdates.
  • A transaction is finished only once Daybook holds it. Until then its report waits on disk and is sent again with backoff, from 5 seconds up to 10 minutes. With finishing: Finishing.manual the app finishes transactions itself, with getUnfinishedTransactions and finishTransaction.
  • restorePurchases sends everything StoreKit holds for the Apple ID and returns the profile.
  • New error codes: transaction_refused, product_not_found, store_error, transaction_not_found.

0.1.0 #

  • DaybookSubscriptions.activate registers the install with Daybook and settles the customer it acts as. With Daybook out of reach, an install that has a customer from before goes on as that customer, with the profile it kept.
  • getProfile, profileUpdates, identify and logout. The profile comes as typed models: access levels, purchases, and isActive(level).
  • Errors come as DaybookSubscriptionsException, with Daybook's own code.
0
likes
160
points
137
downloads

Documentation

API reference

Publisher

verified publisherdaybook.team

Weekly Downloads

Purchases for Flutter on Daybook: StoreKit 2 and Google Play Billing subscriptions that are never lost, access you can check, and paywalls as data.

Homepage

Topics

#in-app-purchase #subscriptions #billing #paywall #daybook

License

MIT (license)

Dependencies

daybook, flutter

More

Packages that depend on daybook_subscriptions

Packages that implement daybook_subscriptions