feat(billing): auto-wire native Play/StoreKit client — commonMain-only consumer integration - #126
Merged
therajanmaurya merged 1 commit intoJul 25, 2026
Conversation
…ytelabs/paycraft/PayCraftInitializer.kt cmp-paycraft/src/androidMain/kotlin/com/mobilebytelabs/paycraft/PayCraftPlatform.android.kt cmp-paycraft/src/commonMain/kotlin/com/mobilebytelabs/paycraft/di/PayCraftModule.kt
|
@therajanmaurya is attempting to deploy a commit to the MobileByteLabs' projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (10)
📝 WalkthroughWalkthroughChangesNative billing auto-wiring
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Startup as PayCraftInitializer
participant Platform as PayCraftPlatform
participant Billing as PlayBillingNativeClient
Startup->>Platform: Start Activity lifecycle tracking
Platform->>Platform: Store resumed Activity weak reference
Billing->>Platform: Request application context and Activity
Platform-->>Billing: Provide Android billing inputs
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
therajanmaurya
marked this pull request as ready for review
July 25, 2026 09:41
therajanmaurya
merged commit Jul 25, 2026
095369f
into
MobileByteLabs:development
6 of 8 checks passed
therajanmaurya
added a commit
that referenced
this pull request
Aug 2, 2026
* fix(dashboard): surface Google Play + App Store on the Providers list (#123) The store-sync credential pages (/providers/google-play, /providers/app-store) shipped in 2.2.0 but were never linked from the Providers index (only web PSPs render there), so they were unreachable. Adds an 'In-app billing (native app stores)' section with Connect/Manage cards + live connection status. * fix(dashboard): surface store sync in products UI (bulk + badges + Re-sync feedback) (#124) * fix(dashboard): surface Google Play + App Store on the Providers list (#123) The store-sync credential pages (/providers/google-play, /providers/app-store) shipped in 2.2.0 but were never linked from the Providers index (only web PSPs render there), so they were unreachable. Adds an 'In-app billing (native app stores)' section with Connect/Manage cards + live connection status. * fix(dashboard): surface store sync in products UI (bulk + badges + Re-sync) Closes the two store-sync UI gaps from 2.2.0: - Bulk 'sync-to-providers' now includes Google Play + App Store. - Products table shows Play / App Store badges; per-product Re-sync panel + unsynced banner + sync panel surface store connection/results. Matches the /sync route snake_case keys (google_play/app_store). tsc clean. * chore(source): update .github/workflows/deploy-cloud.yml dashboard/app/api/products/[id]/sync/route.ts dashboard/app/api/products/sync-to-providers/route.ts * chore(source): update dashboard/__tests__/lib/googleplay-product-sync.test.ts dashboard/app/api/products/[id]/sync/route.ts dashboard/app/api/products/sync-to-providers/route.ts * chore(source): update cmp-paycraft/src/androidMain/kotlin/com/mobilebytelabs/paycraft/PayCraftInitializer.kt cmp-paycraft/src/androidMain/kotlin/com/mobilebytelabs/paycraft/PayCraftPlatform.android.kt cmp-paycraft/src/commonMain/kotlin/com/mobilebytelabs/paycraft/di/PayCraftModule.kt (#126) * chore(release): bump paycraft 2.2.0 → 2.3.0 (commonMain-only native billing) (#127) * chore(source): update cmp-paycraft/src/androidMain/kotlin/com/mobilebytelabs/paycraft/PayCraftInitializer.kt cmp-paycraft/src/androidMain/kotlin/com/mobilebytelabs/paycraft/PayCraftPlatform.android.kt cmp-paycraft/src/commonMain/kotlin/com/mobilebytelabs/paycraft/di/PayCraftModule.kt * chore(source): update gradle.properties * feat paywall currency fix native store price and usd fallback (#128) * chore: initialize session branch — feat paywall currency fix native store price and usd fallback * chore(source): update cmp-paycraft/src/androidMain/kotlin/com/mobilebytelabs/paycraft/billing/PlayBillingNativeClient.android.kt cmp-paycraft/src/commonMain/kotlin/com/mobilebytelabs/paycraft/CurrencyResolver.kt cmp-paycraft/src/commonMain/kotlin/com/mobilebytelabs/paycraft/PayCraft.kt * fix(billing): resolve CI blockers on native-billing PR — Android getBillingConfig + ktlint - PlayBillingNativeClient.android: billing-ktx v8 has no suspend getBillingConfig extension; rewrite storefrontCountry() with the callback getBillingConfigAsync wrapped in suspendCancellableCoroutine (fixes 'unresolved reference getBillingConfig' + type inference) - PayCraft.kt: drop leading underscore on two purely-private vars (nativePricesBySku, currentSuite) that have no matching public member — ktlint standard:backing-property-naming was aborting spotless with an AssertionError - spotless reformat of touched files Verified green locally: spotlessCheck, :cmp-paycraft:compileAndroidMain, :cmp-paycraft:compileKotlinIosSimulatorArm64 (native StoreKit2), :cmp-paycraft:jvmTest. * chore: initialize session branch — chore(paycraft): reconcile + close v2 production-readiness epic (OBE by 2.3.x) * chore(source): update .gitignore CHANGELOG.md cmp-paycraft/src/commonMain/kotlin/com/mobilebytelabs/paycraft/CurrencyResolver.kt * chore(source): update cmp-paycraft/src/commonMain/kotlin/com/mobilebytelabs/paycraft/CountryDetector.kt * chore: initialize session branch — fix(auth): multi-tenant login callback redirect + ship platform-provider epic dashboard * chore(source): update dashboard/app/auth/callback/route.ts supabase/.temp/cli-latest --------- Co-authored-by: MobileByteSensei Community <mobilebytesensei@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Auto-wire native billing — consumers integrate in commonMain only
Makes the native in-app-purchase client resolve per platform automatically, so a consumer gets real Google Play Billing on Android with ZERO androidMain wiring — just
PayCraft.initialize(apiKey)from commonMain. Previously consumers had to loadpaycraftPlayBillingModule+ supply anactivityProviderin theirApplication(a platform-specific bootstrap leak that defeats the KMP one-line-setup goal, and that left web checkout as the Android default → the anti-steering Play-policy violation that flagged com.sensei.social).How
platformDefaultNativeBillingClient()— newexpect(commonMain) +actualper platform:PlayBillingNativeClient(Play Billing v8), auto-wired from the Application context + foreground Activity.null→ web checkout (iOS StoreKit2 stays an explicit opt-in since it needs the app's Swift bridge).PayCraftModulenow bindssingle<NativeBillingClient> { platformDefaultNativeBillingClient() ?: WebCheckoutNativeBillingClient() }(was hard-coded WebCheckout).PayCraftInitializer(the existing androidx-startup Initializer that already captures the Application context) now ALSO registers foreground-Activity tracking, solaunchBillingFlowresolves the resumed Activity with no consumer plumbing.PayCraftPlatform.androidgainsapplicationContextOrNull()+ WeakReference-basedcurrentActivityOrNull()/startActivityTracking().paycraftPlayBillingModule/paycraftStoreKit2BillingModuleremain as explicit overrides (custom activityProvider, or a consumer who disabled the Initializer).Verified
BUILD SUCCESSFULcompiling androidMain + iosSimulatorArm64 + jvm + js + wasmJs, and a new jvmTest asserts the web-platform fallback (platformDefaultNativeBillingClient()== null → WebCheckout).Follow-up (separate)
Publish as 2.3.0, then reels-downloader drops its explicit
AndroidApp.ktwiring and just bumps the version.Summary by CodeRabbit
New Features
Bug Fixes
Tests