Use this page with AI
Copy this into your coding assistant and add your request.
Read https://openiap.dev/docs/types/request-purchase-props and https://openiap.dev/llms.txt. Follow the reading instructions, detailed reference, and linked guides relevant to my task before making changes.
Inspect my existing project and reuse its framework and conventions. Ask me for missing product decisions. Implement the requested behavior and run the applicable checks.
Show the working result, the commands and actual test results, and any remaining limitations. Keep your explanation brief.
My request: [describe what customers should be able to do]RequestPurchaseProps
Request Types#
Types used when initiating purchases via requestPurchase().
Discriminated input to requestPurchase (type: 'in-app' | 'subs'). iOS: maps to Product.purchase(options:) (Apple docs). Android: maps to BillingClient.launchBillingFlow (Google docs).
Native references: Apple · Product.purchase(options:) · Google · BillingFlowParams
RequestPurchaseProps#
Top-level arguments for requestPurchase(). Wraps platform-specific props with a type discriminator.
| Name | Type | Summary |
|---|---|---|
request | RequestPurchasePropsByPlatforms | RequestSubscriptionPropsByPlatforms | Platform-specific parameters matching type. Generated native types expose a purchase/subscription union (or separate requestPurchase and requestSubscription fields) so a subscription cannot be encoded as a one-time request. |
type | "in-app" | "subs" | Purchase type discriminator |
Usage Example#
swift
// Standard in-app purchase
try await OpenIapModule.shared.requestPurchase(
RequestPurchaseProps(
request: .purchase(RequestPurchasePropsByPlatforms(
apple: RequestPurchaseIosProps(sku: "premium")
)),
type: .inApp
)
)
// Subscription purchase
try await OpenIapModule.shared.requestPurchase(
RequestPurchaseProps(
request: .subscription(RequestSubscriptionPropsByPlatforms(
apple: RequestSubscriptionIosProps(sku: "monthly_sub")
)),
type: .subs
)
)RequestPurchasePropsByPlatforms#
Platform-specific request structure for regular purchases (in-app).
| Name | Summary |
|---|---|
apple | Apple purchase parameters (RequestPurchaseIosProps) |
google | Google purchase parameters (RequestPurchaseAndroidProps) |
RequestSubscriptionPropsByPlatforms#
Platform-specific request structure for subscriptions.
| Name | Summary |
|---|---|
apple | Apple subscription parameters (RequestSubscriptionIosProps) |
google | Google subscription parameters (RequestSubscriptionAndroidProps) |
Platform-Specific Request Props#
RequestPurchaseIosProps#
| Name | Summary |
|---|---|
sku | Product identifier to purchase (required) |
andDangerouslyFinishTransactionAutomatically | Auto-finish transaction without validation (use with caution) |
appAccountToken | UUID linking purchase to your server's user. Must be a valid UUID format (e.g., 550e8400-e29b-41d4-a716-446655440000). If a non-UUID value is provided, Apple will silently return null for this field in the purchase response. |
quantity | Number of items to purchase |
withOffer | Signed iOS subscription promotional offer input (DiscountOfferInputIOS) |
advancedCommerceData | Attribution data token for StoreKit 2's Product.PurchaseOption.custom API. Used for campaign tokens, affiliate IDs, or other attribution data. (iOS 15+) |
Subscription Request Props#
RequestSubscriptionIosProps#
iOS subscriptions extend RequestPurchaseIosProps with these additional subscription-only fields:
| Name | Summary |
|---|---|
winBackOffer | Win-back offer to re-engage churned subscribers (iOS 18+). |
promotionalOfferJWS | JWS-signed promotional offer (iOS 15+, WWDC 2025). |
billingPlanType | StoreKit 26.4 billing plan for auto-renewable subscriptions: monthly for monthly billing with commitment or up-front for full-period payment. Omit on older OS versions and do not pass unknown. See SubscriptionBillingPlanTypeIOS. |
compactJWS | Compact JWS string for overriding introductory offer eligibility (iOS 15+, WWDC 2025). Generate it on your server and omit it to let the system decide. |