@mpgd/capacitor-play-billing 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -3
- package/dist/store-sdk.js +2 -0
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -122,6 +122,27 @@ discarded. The plugin still never acknowledges or consumes;
|
|
|
122
122
|
`isAcknowledged: false` on a purchased entry marks it unfinished for the
|
|
123
123
|
backend finalizer.
|
|
124
124
|
|
|
125
|
+
### Generated games
|
|
126
|
+
|
|
127
|
+
Games generated by `mpgd game create` (and the kit's private starter) ship
|
|
128
|
+
this wiring in `src/platform/buildGateways/capacitorAndroid.ts` (commerce v2
|
|
129
|
+
PR C3): the service provider is registered for every catalog product whose
|
|
130
|
+
`platformProductIds.android` names a Play SKU (subscriptions are skipped),
|
|
131
|
+
and `accountBinding` is the reference binding in
|
|
132
|
+
`src/platform/commerceAccountBinding.ts`, the 64-character hex SHA-256 of
|
|
133
|
+
`mpgd-commerce-account:<playerId>` for the authenticated player (a guest
|
|
134
|
+
session binds nothing, so the purchase is refused with
|
|
135
|
+
`ACCOUNT_BINDING_REQUIRED`). The backend's `resolveObfuscatedAccountId`
|
|
136
|
+
must derive the same value, or both are replaced together.
|
|
137
|
+
|
|
138
|
+
`mpgd target init capacitor --providers play-billing` installs this package
|
|
139
|
+
into the game-owned shell and the game at one exact version and lets
|
|
140
|
+
`cap add` or `cap sync` register its native module; on a game that still has
|
|
141
|
+
the unwired gateway of an earlier template it also writes the wiring above.
|
|
142
|
+
A build whose shell lacks the native module still runs: the plugin answers
|
|
143
|
+
Capacitor's `UNIMPLEMENTED`, which the SDK reports as
|
|
144
|
+
`configuration-required`, so no purchase UI opens.
|
|
145
|
+
|
|
125
146
|
### Migrating from the v1 provider
|
|
126
147
|
|
|
127
148
|
`createCapacitorPlayBillingProvider` and `recoverOwnedPlayPurchases` are
|
|
@@ -132,9 +153,13 @@ into an `accountBinding` resolver returning `{ kind: 'obfuscated-account-id',
|
|
|
132
153
|
value }`, rename `id`/`storeId`/`type` to `logicalId`/`storeSku`/`kind`
|
|
133
154
|
(`non_consumable` becomes `durable`) and `offerToken` to `offerId`, and stop
|
|
134
155
|
calling `recoverOwnedPlayPurchases`: it is deprecated in favour of the single
|
|
135
|
-
reconciler
|
|
136
|
-
`
|
|
137
|
-
|
|
156
|
+
reconciler in `@mpgd/game-services` (`createCommerceReconciler`, behind
|
|
157
|
+
`createGameServicesClient` and `monetizationRecovery.reconcile()` whenever
|
|
158
|
+
`gateway.commerceV2` exists), which reads `getAvailablePurchases` and
|
|
159
|
+
`purchaseUpdated` from the provider and verifies each purchase under the same
|
|
160
|
+
`play-token-sha256` key. The backend contract is unchanged, since the
|
|
161
|
+
evidence payload is the same; `src/commerce-reconciler-play-smoke.test.ts`
|
|
162
|
+
shows both paths reaching the same outcomes over the fake plugin.
|
|
138
163
|
|
|
139
164
|
## v1 provider
|
|
140
165
|
|
package/dist/store-sdk.js
CHANGED
|
@@ -42,6 +42,8 @@ const obfuscatedAccountIdPattern = /^[A-Za-z0-9._-]{1,64}$/u;
|
|
|
42
42
|
const maximumProducts = 100;
|
|
43
43
|
const maximumPurchaseTimeMillis = 8_640_000_000_000_000;
|
|
44
44
|
const configurationErrorCodes = new Set([
|
|
45
|
+
// Capacitor's `UNIMPLEMENTED`: the native plugin is not installed in the shell.
|
|
46
|
+
'UNIMPLEMENTED',
|
|
45
47
|
'PLAY_BILLING_CONFIGURATION_ERROR',
|
|
46
48
|
'PLAY_BILLING_PRODUCT_UNAVAILABLE',
|
|
47
49
|
'PLAY_BILLING_OFFER_REQUIRED',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpgd/capacitor-play-billing",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Opt-in Android Google Play Billing purchase collector for mpgd Capacitor games.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
],
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@capacitor/core": "^8.5.1",
|
|
41
|
-
"@mpgd/adapter-capacitor": "^0.9.
|
|
42
|
-
"@mpgd/bridge": "^0.12.
|
|
43
|
-
"@mpgd/platform": "^0.
|
|
41
|
+
"@mpgd/adapter-capacitor": "^0.9.3",
|
|
42
|
+
"@mpgd/bridge": "^0.12.3",
|
|
43
|
+
"@mpgd/platform": "^0.22.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@capacitor/core": "8.5.2",
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
"ttsc": "0.30.4",
|
|
49
49
|
"typescript": "7.0.2",
|
|
50
50
|
"vitest": "^4.0.0",
|
|
51
|
-
"@mpgd/adapter-capacitor": "0.9.
|
|
52
|
-
"@mpgd/bridge": "0.12.
|
|
53
|
-
"@mpgd/
|
|
54
|
-
"@mpgd/
|
|
51
|
+
"@mpgd/adapter-capacitor": "0.9.3",
|
|
52
|
+
"@mpgd/bridge": "0.12.3",
|
|
53
|
+
"@mpgd/platform": "0.22.0",
|
|
54
|
+
"@mpgd/game-services": "0.23.0"
|
|
55
55
|
},
|
|
56
56
|
"main": "./dist/index.js",
|
|
57
57
|
"types": "./dist/index.d.ts",
|