cordova-plugin-harfin-billing
v1.1.0
Published
Google Play Billing bridge for Harf'in Izinde
Maintainers
Readme
cordova-plugin-harfin-billing
Android Cordova bridge for Google Play Billing Library 9.1.0. The plugin exposes generic one-time-product queries, purchase launch, owned-purchase recovery, consumption, and acknowledgement. It does not contain product IDs, prices, game rewards, or entitlement rules.
Install
cordova plugin add [email protected]The plugin adds com.android.vending.BILLING, includes the Billing 9.1.0 dependency, and packages the monochrome harfin_notification_small Android drawable.
JavaScript API
All methods return Promises:
initializeBilling()isBillingReady()queryProducts(productIds)purchase(productId)queryOwnedPurchases()consumePurchase(purchaseToken)acknowledgePurchase(purchaseToken)getLastBillingResult()
Only purchases whose state is PURCHASED are candidates for game-layer entitlement processing. PENDING purchases are returned without granting anything. Consumption and acknowledgement remain explicit game-layer operations.
1.0.1 local concurrency hardening
One BillingClient; DISCONNECTED/CONNECTING/READY states. Each operation owns an exactly-once callback and timeout. Failed setup/disconnect completes all waiting/in-flight requests. Reconnection only occurs on the next explicit request. Queries/consume/ack time out after 60 seconds; purchase UI requests after 5 minutes.
Purchase mutex is reserved before owned/product queries. A different or duplicate purchase receives PURCHASE_IN_PROGRESS. Pending products are checked through queryPurchasesAsync before launching; PENDING is not a reward/entitlement. No game rewards are granted by this plugin.
Consume and acknowledge share a per-token in-flight lock; different tokens may execute in parallel. Completion, failure, timeout and disconnect release locks.
getLastBillingResult preserves the last purchase terminal result against query errors, adds operationResults and drains a bounded 64-result queue. Results include operation/requestId. ProductDetails/Purchase payload shapes remain compatible. No tokens are logged.
This source version is prepared locally. Publishing and switching the main GDevelop dependency are separate authorized steps. Billing Library remains 9.1.0.
1.1.0 dynamic one-time offers (development, not yet published)
queryProducts(productIds, options?) queries current eligible Play offers. Options may contain purchaseOptionIds: {productId: optionId} to explicitly select equivalent rights, and preferredOfferTags: [] for equal-price ties. Campaign IDs/tags are never required. A backward-compatible BUY option is preferred when provided by Play, otherwise a unique BUY option is accepted; multiple unresolved options return a non-purchasable result. Rental/preorder, expired/future/exhausted and unidentified non-discount conditions are excluded. Currency groups are never mixed.
Within one option the lowest payable micros wins. Ties prefer the base price, then optional tags, then lexical offer ID/token. formattedPrice is copied from the same selected offer that will be sent to Billing. Fields selectedOffer, selectionVersion:1, purchasable, offerId, offerToken, purchaseOptionId, offerTags, fetchedAt, optional validUntil, fullPriceMicros, originalFormattedPrice, discountPercentage extend the existing response. An original formatted price is emitted only when an eligible Play base offer corroborates it. Percentages come from Play, never from hard-coded campaigns or local discount calculations.
purchase(productId, expectedQuote?) always queries fresh ProductDetails. The expected quote contains productId/purchaseOptionId/offerId/offerToken/formattedPrice/priceAmountMicros/priceCurrencyCode from the displayed product. If omitted, the last in-session queried display quote is used for compatibility. No previous quote means PRICE_NOT_READY, not an unseen price. A changed quote returns PRICE_CHANGED plus the new product and requiresReconfirmation:true; no payment UI launches. Caller must display the updated price and wait for a new explicit tap. ITEM_UNAVAILABLE returns OFFER_UNAVAILABLE; caller refreshes and asks again instead of automatically launching another offer. ProductDetails are not cached.
This plugin does not know reward quantities and never grants coins. Existing purchase/pending/consume/ack lifecycle is preserved. No server-side purchase verification was added. Real Play Store campaign eligibility and checkout require licensed-device testing after publication and the one-time application integration update. Future discounts on the same purchase options need no code or plugin update.
