shinyorg/shiny/shiny-inapppurchases
Claude Code and agent skill by shinyorg/shiny
- community
Checking that the SKILL.md file is still in the repository.
Generate code using Shiny.Mobile.InAppPurchases (in-app purchases over StoreKit 2 on iOS and Google Play Billing 9 on Android) and Shiny.Mobile.InAppPurchases.Server (ASP.NET Core purchase verification, App Store Server Notifications V2 and Google Play Real-time Developer Notifications)
Install
npx vskill@latest install shinyorg/shiny/shiny-inapppurchasesSKILL.md
The same SKILL.md was published earlier as shinyorg/shiny/shiny-inapppurchases.
Shiny.Mobile.InAppPurchases
In-app purchases (consumables, non-consumables, auto-renewable subscriptions) for iOS and Android, plus an ASP.NET Core backend. This is not Apple Pay / Google Pay card processing: those go through a payment processor, and Apple/Google send no notifications for them.
| Package | Targets | Use in | |
|---|---|---|---|
Shiny.Mobile.InAppPurchases | net11.0-ios (15+), net11.0-android (API 26+), net11.0 (contracts only) | The app (any Shiny host, MAUI not required) | |
Shiny.Mobile.InAppPurchases.Server | net11.0 + ASP.NET Core | Your backend |
Namespaces: Shiny.InAppPurchases (client) and Shiny.InAppPurchases.Server (server); the registration extensions (AddInAppPurchases, AddInAppPurchaseServer, MapInAppPurchaseWebhooks, MapInAppPurchaseVerification) live in Shiny.
Rules — always follow
- Never grant a `Pending` purchase. It is redelivered through
IPurchaseDelegatewhen it resolves. - Verify, grant, then finish.
PurchaseAsyncnever finishes anything. CallFinishPurchaseAsynconly after the entitlement is
stored. Google Play refunds purchases not acknowledged within 3 days (minutes for license testers).
- Consumable vs non-consumable is decided at finish time:
FinishPurchaseAsync(purchase, consume: true)for things that can be
bought again. Google Play does not model consumables, and ProductType is only OneTime / Subscription.
- Verify on the server with
Purchase.VerificationData(Apple signed JWS / Google purchase token). Don't trust the device. - Never grant an unverified purchase. On Apple, a transaction that fails StoreKit's on-device verification arrives
like any other (from PurchaseAsync as Success, from GetUnfinishedPurchasesAsync, GetEntitlementsAsync and IPurchaseDelegate) with Purchase.IsVerified == false and the reason in VerificationError. Log it and finish it without granting, or send it to the server, which rejects the JWS - but always finish it, or StoreKit redelivers it on every launch. Google Play purchases are always IsVerified == true (Play verification is server-side only).
- Handle updates idempotently, keyed on
TransactionIdon the client andNotificationId/TransactionIdon the server. - Always set
PurchaseOptions.AccountToken(aGuid, your user id). It comes back as AppleappAccountToken/
Google obfuscatedAccountId, both on-device and in server notifications.
- Libraries use Shiny.Core only. Do not suggest MAUI Essentials APIs inside library code.
- Replay protection on the server. A verified purchase can be sent again (a retry, or a captured token/JWS replayed),
and a finished Apple consumable or a consumed Google token still verifies with IsActive == true. Grant at most once per VerifiedPurchase.TransactionId (Apple transactionId, Google orderId) - store it with a unique constraint and treat a repeat as "already granted". On Google one-time products also refuse a token with IsConsumed == true (it was already granted and finished). IsConsumed is null on Apple (not reported) and for subscriptions.
Client registration
The platform listener (StoreKit Transaction.updates, Play PurchasesUpdatedListener plus a launch-time recovery query) starts as an IShinyStartupTask, so updates that arrive while no page is open are not lost. On a MAUI host this needs .UseShiny().
IInAppPurchaseManager
GetProductsAsync omits unknown ids instead of throwing. Genuine failures throw InAppPurchaseException with ErrorCode: StoreUnavailable, NotAllowed, ProductNotFound, ProductUnavailable, Network, DeveloperError, VerificationFailed, NoUserInterface, InvalidState, Unknown (plus NativeErrorCode). A user cancelling is not an exception.
Purchasing
Out-of-band updates
Delegates are resolved lazily, so they may inject IInAppPurchaseManager. At app start, also call GetUnfinishedPurchasesAsync() and run each purchase through the same verify → grant → finish path.
Subscriptions & offers
StoreProduct.SubscriptionOffers:- Google: one entry per base plan and per eligible offer. Pass
SubscriptionOffer.OfferTokenas
PurchaseOptions.OfferToken (defaults to the first base plan).
- Apple: the introductory offer (only if eligible, applied automatically) plus promotional offers (ids only; signed
promotional offer purchases are not supported).
PricingPhasehasBillingPeriod(ISO 8601P1W/P1M/P1Y),BillingCycleCount(0 = recurring), andPaymentMode
(Recurring, FreeTrial, PayAsYouGo, PayUpFront).
- Google upgrades/downgrades:
PurchaseOptions.Replacement = new SubscriptionReplacement(oldProductId, oldPurchaseToken, SubscriptionReplacementMode.ChargeProratedPrice). Apple handles changes within a subscription group and ignores Replacement.
PurchaseOptions.Quantity: Apple consumables only (1–10).
Purchase record mapping
| Property | Apple | ||
|---|---|---|---|
TransactionId | transaction id (new per renewal) | order id (purchase token while pending) | |
OriginalTransactionId | original transaction id | purchase token | |
VerificationData | signed JWS | purchase token | |
ExpirationDate | set for subscriptions | always null (ask the server) | |
IsFinished | finished | acknowledged | |
Environment | Production / Sandbox / Xcode | Unknown | |
Signature | null | RSA signature of OriginalJson | |
IsVerified / VerificationError | false + reason when StoreKit verification fails | always true / null |
Server
Options (InAppPurchaseServerOptions):
- `Apple` (
AppleStoreOptions):BundleId(required),AppAppleId(required for Production notifications),AllowSandbox(default true),
UseSandboxServerApi, EnableOnlineRevocationCheck, IssuerId + KeyId + PrivateKey (.p8 PEM; all three or none).
- `Google` (
GooglePlayOptions):PackageName(required),ServiceAccountJson(needed to verify purchases and fetch notification details),
RequirePubSubAuthentication (default true), PubSubAudience, PubSubServiceAccountEmail.
- General: a null store section disables that endpoint.
DeduplicationWindow(7 days),DeduplicationCapacity. Validated at startup.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/shiny-inapppurchases/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/shinyorg/shiny/shiny-inapppurchases)