Skip to content

feat: expose jwsRepresentation for server-side transaction verification#8

Merged
nikmomo merged 3 commits into
mainfrom
fix/expose-jws-representation
Mar 26, 2026
Merged

feat: expose jwsRepresentation for server-side transaction verification#8
nikmomo merged 3 commits into
mainfrom
fix/expose-jws-representation

Conversation

@nikmomo
Copy link
Copy Markdown
Contributor

@nikmomo nikmomo commented Mar 26, 2026

Summary

  • Add jwsRepresentation property to PaymentTransaction — the JWS (JSON Web Signature) string from StoreKit 2's VerificationResult, required for server-side Apple transaction verification
  • Pass VerificationResult.jwsRepresentation through all code paths: purchaseProduct, checkPurchaseStatus, collectCurrentEntitlements, findCurrentEntitlement, startTransactionListener
  • Update C# binding (ApiDefinitions.cs) to expose the new property
  • Rebuild StoreKit2Framework.framework binary
  • Bump version to 1.1.0
  • Add unit tests verifying JWS property via ObjC runtime introspection

Background

The server's /payment/api/v1/payment/apple/verify endpoint expects a JWS token (format: header.payload.signature, 3 Base64URL-encoded parts separated by dots). Previously, only TransactionId (a numeric string like 20000011428506923) was available in the C# binding, causing the server to return:

Transaction verification failed: Invalid JWS format. Expected 3 parts, got 1

With this change, consumers can use paymentTransaction.JwsRepresentation to get the correct JWS string for server verification.

Test plan

  • Swift framework builds successfully for both iphoneos and iphonesimulator
  • jwsRepresentation property confirmed in .swiftinterface and binary (strings check)
  • Unit tests (4/4 passed): ObjC selector exists, JWS format validation, API chain verification, runtime property inspection
  • Integration test: full StoreKit sandbox purchase requires host app with matching bundle ID (cannot be tested in framework unit tests)
  • Server acceptance: staging endpoint requires auth token for /payment/api/v1/payment/apple/verify

🤖 Generated with Claude Code

nikmomo and others added 3 commits March 26, 2026 16:57
…verification

The server's Apple verify endpoint expects a JWS (JSON Web Signature) string
(header.payload.signature format) but the binding only exposed TransactionId
(a numeric ID), causing "Invalid JWS format. Expected 3 parts, got 1" errors.

Changes:
- Add `jwsRepresentation` property to PaymentTransaction (Swift + C# binding)
- Pass VerificationResult.jwsRepresentation through all code paths:
  purchaseProduct, checkPurchaseStatus, collectCurrentEntitlements,
  findCurrentEntitlement, startTransactionListener
- Rebuild StoreKit2Framework.framework binary with the new property
- Bump version to 1.1.0

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ransaction

4 tests verify:
- ObjC selector exists on PaymentTransaction class
- JWS 3-part format vs numeric transactionId (the bug)
- StoreKit 2 API chain correctness at compile time
- ObjC runtime property inspection (readonly NSString)

Includes StoreKit Testing configuration with VIP monthly subscription product.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- MAUI.StoreKit2.csproj: net8.0-ios → net10.0-ios (net8.0-ios is EOL)
- CI workflow: dotnet-version 8.0.x → 10.0.x

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@nikmomo nikmomo merged commit 97cd0cd into main Mar 26, 2026
1 check passed
@nikmomo nikmomo deleted the fix/expose-jws-representation branch March 26, 2026 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant