Skip to content

Commit ce93d37

Browse files
authored
feat: verify purchase with provider (#46)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Add provider-based purchase verification (IAPKit) with a verifyPurchaseWithProvider mutation returning per-provider/store results. * **Refactor** * Rename receipt validation APIs/types to VerifyPurchase* and update error codes/messages; include deprecated compatibility aliases. * **Tests** * Add extensive unit tests covering IAPKit and platform verification flows. * **Documentation** * Update docs, examples and sample apps with verification guidance, configuration, UI for selecting verification methods and API key usage. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 8252ee3 commit ce93d37

68 files changed

Lines changed: 5336 additions & 1152 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/guides/04-apple-package.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public protocol OpenIapModuleProtocol {
4040
func fetchProducts(_ params: ProductRequest) async throws -> FetchProductsResult
4141
func requestPurchase(_ params: RequestPurchaseProps) async throws -> RequestPurchaseResult?
4242
func finishTransaction(purchase: PurchaseInput, isConsumable: Bool?) async throws -> Void
43-
func verifyPurchase(_ props: ReceiptValidationProps) async throws -> ReceiptValidationResult
43+
func verifyPurchase(_ props: VerifyPurchaseProps) async throws -> VerifyPurchaseResult
4444
// ... more methods
4545
}
4646
```

.vscode/settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"cSpell.words": [
33
"hyodotdev",
4-
"openiap"
4+
"Iapkit",
5+
"openiap",
6+
"Skus"
57
],
68
"files.associations": {
79
"*.podspec": "ruby"

packages/apple/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ swift test
4242
#### OpenIap Prefix (Public Models)
4343

4444
- Prefix all public model types with `OpenIap`.
45-
- Examples: `ProductIOS`, `PurchaseIOS`, `ProductIOSRequest`, `RequestPurchaseProps`, `PurchaseIOSOptions`, `ReceiptValidationProps`, `ReceiptValidationResultIOS`, `ActiveSubscription`, `PurchaseIOSState`, `PurchaseIOSOffer`, `ProductIOSType`, `ProductIOSTypeIOS`.
45+
- Examples: `ProductIOS`, `PurchaseIOS`, `ProductRequest`, `RequestPurchaseProps`, `PurchaseOptions`, `VerifyPurchaseProps`, `VerifyPurchaseResultIOS`, `ActiveSubscription`, `PurchaseState`, `PurchaseOfferIOS`, `ProductTypeIOS`.
4646
- Private/internal helper types do not need the prefix.
4747
- When renaming existing types, add a public `typealias` from the old name to the new name to preserve source compatibility, then migrate usages incrementally.
4848

packages/apple/Example/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ DerivedData/
66
.swiftpm/configuration/registries.json
77
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
88
.netrc
9+
10+
# Local secrets (API keys)
11+
OpenIapExample/Info.plist

packages/apple/Example/Martie.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@
418418
DEVELOPMENT_ASSET_PATHS = "\"OpenIapExample/Preview Content\"";
419419
ENABLE_PREVIEWS = YES;
420420
GENERATE_INFOPLIST_FILE = YES;
421+
INFOPLIST_FILE = OpenIapExample/Info.plist;
421422
INFOPLIST_KEY_CFBundleDisplayName = OpenIAP;
422423
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
423424
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
@@ -448,6 +449,7 @@
448449
DEVELOPMENT_ASSET_PATHS = "\"OpenIapExample/Preview Content\"";
449450
ENABLE_PREVIEWS = YES;
450451
GENERATE_INFOPLIST_FILE = YES;
452+
INFOPLIST_FILE = OpenIapExample/Info.plist;
451453
INFOPLIST_KEY_CFBundleDisplayName = OpenIAP;
452454
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
453455
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1540"
4+
version = "1.7">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES"
8+
buildArchitectures = "Automatic">
9+
<BuildActionEntries>
10+
<BuildActionEntry
11+
buildForTesting = "YES"
12+
buildForRunning = "YES"
13+
buildForProfiling = "YES"
14+
buildForArchiving = "YES"
15+
buildForAnalyzing = "YES">
16+
<BuildableReference
17+
BuildableIdentifier = "primary"
18+
BlueprintIdentifier = "C0E1F5E42C8F1A9400123456"
19+
BuildableName = "OpenIapExample.app"
20+
BlueprintName = "OpenIapExample"
21+
ReferencedContainer = "container:Martie.xcodeproj">
22+
</BuildableReference>
23+
</BuildActionEntry>
24+
</BuildActionEntries>
25+
</BuildAction>
26+
<TestAction
27+
buildConfiguration = "Debug"
28+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
29+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
30+
shouldUseLaunchSchemeArgsEnv = "YES"
31+
shouldAutocreateTestPlan = "YES">
32+
</TestAction>
33+
<LaunchAction
34+
buildConfiguration = "Debug"
35+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37+
launchStyle = "0"
38+
useCustomWorkingDirectory = "NO"
39+
ignoresPersistentStateOnLaunch = "NO"
40+
debugDocumentVersioning = "YES"
41+
debugServiceExtension = "internal"
42+
allowLocationSimulation = "YES">
43+
<BuildableProductRunnable
44+
runnableDebuggingMode = "0">
45+
<BuildableReference
46+
BuildableIdentifier = "primary"
47+
BlueprintIdentifier = "C0E1F5E42C8F1A9400123456"
48+
BuildableName = "OpenIapExample.app"
49+
BlueprintName = "OpenIapExample"
50+
ReferencedContainer = "container:Martie.xcodeproj">
51+
</BuildableReference>
52+
</BuildableProductRunnable>
53+
<EnvironmentVariables>
54+
<EnvironmentVariable
55+
key = "IAPKIT_API_KEY"
56+
value = "iapkit_f0jyx28mleooxcrrxkmxlh"
57+
isEnabled = "YES">
58+
</EnvironmentVariable>
59+
</EnvironmentVariables>
60+
</LaunchAction>
61+
<ProfileAction
62+
buildConfiguration = "Release"
63+
shouldUseLaunchSchemeArgsEnv = "YES"
64+
savedToolIdentifier = ""
65+
useCustomWorkingDirectory = "NO"
66+
debugDocumentVersioning = "YES">
67+
<BuildableProductRunnable
68+
runnableDebuggingMode = "0">
69+
<BuildableReference
70+
BuildableIdentifier = "primary"
71+
BlueprintIdentifier = "C0E1F5E42C8F1A9400123456"
72+
BuildableName = "OpenIapExample.app"
73+
BlueprintName = "OpenIapExample"
74+
ReferencedContainer = "container:Martie.xcodeproj">
75+
</BuildableReference>
76+
</BuildableProductRunnable>
77+
</ProfileAction>
78+
<AnalyzeAction
79+
buildConfiguration = "Debug">
80+
</AnalyzeAction>
81+
<ArchiveAction
82+
buildConfiguration = "Release"
83+
revealArchiveInOrganizer = "YES">
84+
</ArchiveAction>
85+
</Scheme>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IAPKIT_API_KEY</key>
6+
<string>YOUR_IAPKIT_API_KEY_HERE</string>
7+
</dict>
8+
</plist>

0 commit comments

Comments
 (0)