PlayPurchaseGateway class

Google Play Billing behind the PurchaseGateway port.

Play is the reason the port has a complete step at all: a purchase that is not acknowledged within three days is automatically refunded, and the money goes back whether or not the player got what they bought. So the order matters and is not this class's to choose — CommerceService verifies with the Worker, commits the entitlement, and only then calls complete.

Everything here is evidence, never permission. A purchased update is a claim that Play says something was bought; the Worker re-reads it from the Android Publisher API before any of it becomes access.

Constructors

PlayPurchaseGateway({String launchTag = defaultPlayLaunchTag, InAppPurchasePlatform? billing, PlayOwnedPurchases? ownedPurchases})

Properties

hashCode → int
The hash code for this object.
no setterinherited
launchTag → String
The offer tag that lets an offer be launched; see defaultPlayLaunchTag.
final
provider → String
Key matching the provider name in the server commerce catalog.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
updates → Stream<PurchaseUpdate>
no setteroverride

Methods

complete(PurchaseUpdate update) → Future<void>
Acknowledges or completes provider delivery after Worker verification.
override
covers(String providerReference, PurchaseUpdate update) → bool
Play's purchase names the product, never a subscription's base plan, so every plan of the product covers it. The Worker reads the plan from Play.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
products(Set<String> providerReferences) → Future<List<StoreProduct>>
Play's products for providerReferences, one per reference.
override
purchase({required String accountId, required String offerKey, required StoreProduct product, required bool repeatable}) → Future<void>
Play carries accountId as obfuscatedAccountId, and the Worker's adapter reads it back as obfuscatedExternalAccountId.
override
restore({required String accountId}) → Future<void>
Replays the store's purchases for accountId onto updates.
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited