Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,22 @@
"console": "integratedTerminal"
},
{
"type": "node-terminal",
"request": "launch",
"name": "📝 GQL: Generate Types",
"command": "bun run generate",
"cwd": "${workspaceFolder}/packages/gql"
"type": "node",
"request": "launch",
"runtimeExecutable": "bash",
"runtimeArgs": ["-lc", "bun run generate"],
"cwd": "${workspaceFolder}/packages/gql",
"console": "integratedTerminal"
},
{
"type": "node-terminal",
"request": "launch",
"name": "📚 Docs: Dev Server",
"command": "bun run dev",
"cwd": "${workspaceFolder}/packages/docs"
"type": "node",
"request": "launch",
"runtimeExecutable": "bash",
"runtimeArgs": ["-lc", "bun run dev"],
"cwd": "${workspaceFolder}/packages/docs",
"console": "integratedTerminal"
},
{
"type": "node-terminal",
Expand Down
50 changes: 50 additions & 0 deletions packages/apple/Sources/Models/Types.swift
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,10 @@ public struct DiscountOffer: Codable {
public var preorderDetailsAndroid: PreorderDetailsAndroid?
/// Numeric price value
public var price: Double
/// [Android] Purchase option ID for this offer.
/// Used to identify which purchase option the user selected.
/// Available in Google Play Billing Library 7.0+
public var purchaseOptionIdAndroid: String?
/// [Android] Rental details if this is a rental offer.
public var rentalDetailsAndroid: RentalDetailsAndroid?
/// Type of discount offer
Expand Down Expand Up @@ -701,6 +705,21 @@ public enum FetchProductsResult {
case subscriptions([ProductSubscription]?)
}

/// Installment plan details for subscription offers (Android)
/// Contains information about the installment plan commitment.
/// Available in Google Play Billing Library 7.0+
public struct InstallmentPlanDetailsAndroid: Codable {
/// Committed payments count after a user signs up for this subscription plan.
/// For example, for a monthly subscription with commitmentPaymentsCount of 12,
/// users will be charged monthly for 12 months after signup.
public var commitmentPaymentsCount: Int
/// Subsequent committed payments count after the subscription plan renews.
/// For example, for a monthly subscription with subsequentCommitmentPaymentsCount of 12,
/// users will be committed to another 12 monthly payments when the plan renews.
/// Returns 0 if the installment plan has no subsequent commitment (reverts to normal plan).
public var subsequentCommitmentPaymentsCount: Int
}

/// Limited quantity information for one-time purchase offers (Android)
/// Available in Google Play Billing Library 7.0+
public struct LimitedQuantityInfoAndroid: Codable {
Expand All @@ -710,6 +729,20 @@ public struct LimitedQuantityInfoAndroid: Codable {
public var remainingQuantity: Int
}

/// Pending purchase update for subscription upgrades/downgrades (Android)
/// When a user initiates a subscription change (upgrade/downgrade), the new purchase
/// may be pending until the current billing period ends. This type contains the
/// details of the pending change.
/// Available in Google Play Billing Library 5.0+
public struct PendingPurchaseUpdateAndroid: Codable {
/// Product IDs for the pending purchase update.
/// These are the new products the user is switching to.
public var products: [String]
/// Purchase token for the pending transaction.
/// Use this token to track or manage the pending purchase update.
public var purchaseToken: String
}

/// Pre-order details for one-time purchase products (Android)
/// Available in Google Play Billing Library 8.1.0+
public struct PreorderDetailsAndroid: Codable {
Expand Down Expand Up @@ -793,6 +826,10 @@ public struct ProductAndroidOneTimePurchaseOfferDetail: Codable {
public var preorderDetailsAndroid: PreorderDetailsAndroid?
public var priceAmountMicros: String
public var priceCurrencyCode: String
/// Purchase option ID for this offer (Android)
/// Used to identify which purchase option the user selected.
/// Available in Google Play Billing Library 7.0+
public var purchaseOptionId: String?
/// Rental details for rental offers
public var rentalDetailsAndroid: RentalDetailsAndroid?
/// Valid time window for the offer
Expand Down Expand Up @@ -862,6 +899,10 @@ public struct ProductSubscriptionAndroid: Codable, ProductCommon {
/// @see https://openiap.dev/docs/types#subscription-offer
public struct ProductSubscriptionAndroidOfferDetails: Codable {
public var basePlanId: String
/// Installment plan details for this subscription offer.
/// Only set for installment subscription plans; null for non-installment plans.
/// Available in Google Play Billing Library 7.0+
public var installmentPlanDetails: InstallmentPlanDetailsAndroid?
public var offerId: String?
public var offerTags: [String]
public var offerToken: String
Expand Down Expand Up @@ -918,6 +959,11 @@ public struct PurchaseAndroid: Codable, PurchaseCommon {
public var obfuscatedAccountIdAndroid: String?
public var obfuscatedProfileIdAndroid: String?
public var packageNameAndroid: String?
/// Pending purchase update for uncommitted subscription upgrade/downgrade (Android)
/// Contains the new products and purchase token for the pending transaction.
/// Returns null if no pending update exists.
/// Available in Google Play Billing Library 5.0+
public var pendingPurchaseUpdateAndroid: PendingPurchaseUpdateAndroid?
public var platform: IapPlatform
public var productId: String
public var purchaseState: PurchaseState
Expand Down Expand Up @@ -1067,6 +1113,10 @@ public struct SubscriptionOffer: Codable {
/// - iOS: Discount identifier from App Store Connect
/// - Android: offerId from ProductSubscriptionAndroidOfferDetails
public var id: String
/// [Android] Installment plan details for this subscription offer.
/// Only set for installment subscription plans; null for non-installment plans.
/// Available in Google Play Billing Library 7.0+
public var installmentPlanDetailsAndroid: InstallmentPlanDetailsAndroid?
/// [iOS] Key identifier for signature validation.
/// Used with server-side signature generation for promotional offers.
public var keyIdentifierIOS: String?
Expand Down
9 changes: 9 additions & 0 deletions packages/docs/src/pages/docs/types/android.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,15 @@ function TypesAndroid() {
</td>
<td>Quantity-limited offer availability</td>
</tr>
<tr>
<td>
<code>purchaseOptionId</code>
</td>
<td>
<code>string | null</code>
</td>
<td>Purchase option ID to identify which option was selected (7.0+)</td>
</tr>
</tbody>
</table>

Expand Down
63 changes: 61 additions & 2 deletions packages/docs/src/pages/docs/types/offer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,15 @@ function TypesOffer() {
</td>
<td>Rental offer details</td>
</tr>
<tr>
<td>
<code>purchaseOptionIdAndroid</code>
</td>
<td>
<code>String</code>
</td>
<td>Purchase option ID for identifying which purchase option was selected (7.0+)</td>
</tr>
</tbody>
</table>

Expand Down Expand Up @@ -263,6 +272,7 @@ function TypesOffer() {
limitedQuantityInfoAndroid?: LimitedQuantityInfoAndroid;
preorderDetailsAndroid?: PreorderDetailsAndroid;
rentalDetailsAndroid?: RentalDetailsAndroid;
purchaseOptionIdAndroid?: string;
}

enum DiscountOfferType {
Expand Down Expand Up @@ -292,6 +302,7 @@ enum DiscountOfferType {
let limitedQuantityInfoAndroid: LimitedQuantityInfoAndroid?
let preorderDetailsAndroid: PreorderDetailsAndroid?
let rentalDetailsAndroid: RentalDetailsAndroid?
let purchaseOptionIdAndroid: String?
}

enum DiscountOfferType: String, Codable {
Expand Down Expand Up @@ -320,7 +331,8 @@ enum DiscountOfferType: String, Codable {
val validTimeWindowAndroid: ValidTimeWindowAndroid? = null,
val limitedQuantityInfoAndroid: LimitedQuantityInfoAndroid? = null,
val preorderDetailsAndroid: PreorderDetailsAndroid? = null,
val rentalDetailsAndroid: RentalDetailsAndroid? = null
val rentalDetailsAndroid: RentalDetailsAndroid? = null,
val purchaseOptionIdAndroid: String? = null
)

enum class DiscountOfferType {
Expand Down Expand Up @@ -350,6 +362,7 @@ enum class DiscountOfferType {
final LimitedQuantityInfoAndroid? limitedQuantityInfoAndroid;
final PreorderDetailsAndroid? preorderDetailsAndroid;
final RentalDetailsAndroid? rentalDetailsAndroid;
final String? purchaseOptionIdAndroid;

DiscountOffer({
this.id,
Expand All @@ -367,6 +380,7 @@ enum class DiscountOfferType {
this.limitedQuantityInfoAndroid,
this.preorderDetailsAndroid,
this.rentalDetailsAndroid,
this.purchaseOptionIdAndroid,
});
}

Expand Down Expand Up @@ -398,6 +412,7 @@ var valid_time_window_android: ValidTimeWindowAndroid
var limited_quantity_info_android: LimitedQuantityInfoAndroid
var preorder_details_android: PreorderDetailsAndroid
var rental_details_android: RentalDetailsAndroid
var purchase_option_id_android: String

enum DiscountOfferType {
INTRODUCTORY,
Expand Down Expand Up @@ -627,6 +642,15 @@ enum DiscountOfferType {
</td>
<td>Pricing phases (trial, intro, regular)</td>
</tr>
<tr>
<td>
<code>installmentPlanDetailsAndroid</code>
</td>
<td>
<code>InstallmentPlanDetailsAndroid</code>
</td>
<td>Installment plan details for subscription commitments (7.0+)</td>
</tr>
</tbody>
</table>

Expand Down Expand Up @@ -660,6 +684,12 @@ enum DiscountOfferType {
offerTokenAndroid?: string;
offerTagsAndroid?: string[];
pricingPhasesAndroid?: PricingPhasesAndroid;
installmentPlanDetailsAndroid?: InstallmentPlanDetailsAndroid;
}

interface InstallmentPlanDetailsAndroid {
commitmentPaymentsCount: number;
subsequentCommitmentPaymentsCount: number;
}

interface SubscriptionPeriod {
Expand Down Expand Up @@ -707,6 +737,12 @@ enum PaymentMode {
let offerTokenAndroid: String?
let offerTagsAndroid: [String]?
let pricingPhasesAndroid: PricingPhasesAndroid?
let installmentPlanDetailsAndroid: InstallmentPlanDetailsAndroid?
}

struct InstallmentPlanDetailsAndroid: Codable {
let commitmentPaymentsCount: Int
let subsequentCommitmentPaymentsCount: Int
}

struct SubscriptionPeriod: Codable {
Expand Down Expand Up @@ -753,7 +789,13 @@ enum PaymentMode: String, Codable {
val basePlanIdAndroid: String? = null,
val offerTokenAndroid: String? = null,
val offerTagsAndroid: List<String>? = null,
val pricingPhasesAndroid: PricingPhasesAndroid? = null
val pricingPhasesAndroid: PricingPhasesAndroid? = null,
val installmentPlanDetailsAndroid: InstallmentPlanDetailsAndroid? = null
)

data class InstallmentPlanDetailsAndroid(
val commitmentPaymentsCount: Int,
val subsequentCommitmentPaymentsCount: Int
)

data class SubscriptionPeriod(
Expand Down Expand Up @@ -794,6 +836,7 @@ enum class PaymentMode {
final String? offerTokenAndroid;
final List<String>? offerTagsAndroid;
final PricingPhasesAndroid? pricingPhasesAndroid;
final InstallmentPlanDetailsAndroid? installmentPlanDetailsAndroid;

SubscriptionOffer({
required this.id,
Expand All @@ -814,6 +857,17 @@ enum class PaymentMode {
this.offerTokenAndroid,
this.offerTagsAndroid,
this.pricingPhasesAndroid,
this.installmentPlanDetailsAndroid,
});
}

class InstallmentPlanDetailsAndroid {
final int commitmentPaymentsCount;
final int subsequentCommitmentPaymentsCount;

InstallmentPlanDetailsAndroid({
required this.commitmentPaymentsCount,
required this.subsequentCommitmentPaymentsCount,
});
}

Expand Down Expand Up @@ -854,6 +908,11 @@ var base_plan_id_android: String
var offer_token_android: String
var offer_tags_android: Array[String]
var pricing_phases_android: PricingPhasesAndroid
var installment_plan_details_android: InstallmentPlanDetailsAndroid

class InstallmentPlanDetailsAndroid:
var commitment_payments_count: int
var subsequent_commitment_payments_count: int

class SubscriptionPeriod:
var unit: SubscriptionPeriodUnit
Expand Down
73 changes: 73 additions & 0 deletions packages/docs/src/pages/docs/types/purchase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,81 @@ function TypesPurchase() {
)
</td>
</tr>
<tr>
<td>
<code>pendingPurchaseUpdateAndroid</code>
</td>
<td>
Pending subscription upgrade/downgrade details. When a user
initiates a plan change, this contains the new product IDs
and purchase token for the pending transaction. Returns null
if no pending update exists. See{' '}
<a href="#pending-purchase-update-android">
PendingPurchaseUpdateAndroid
</a>{' '}
below. (
<a
href="https://developer.android.com/reference/com/android/billingclient/api/Purchase.PendingPurchaseUpdate"
target="_blank"
rel="noopener noreferrer"
>
Billing Library 5.0+
</a>
)
</td>
</tr>
</tbody>
</table>

<div style={{ marginTop: '1rem' }}>
<AnchorLink id="pending-purchase-update-android" level="h4">
PendingPurchaseUpdateAndroid{' '}
<span style={{ fontSize: '0.85rem', fontWeight: 'normal' }}>
(from{' '}
<a
href="https://developer.android.com/reference/com/android/billingclient/api/Purchase.PendingPurchaseUpdate"
target="_blank"
rel="noopener noreferrer"
>
Purchase.PendingPurchaseUpdate
</a>
)
</span>
</AnchorLink>
<p>
Contains details about a pending subscription upgrade or downgrade.
When a user changes their subscription plan, the new plan may be
pending until the current billing period ends.
</p>
<table className="doc-table" style={{ marginTop: '0.5rem' }}>
<thead>
<tr>
<th>Name</th>
<th>Summary</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>products</code>
</td>
<td>
List of product IDs for the pending purchase update.
These are the new products the user is switching to.
</td>
</tr>
<tr>
<td>
<code>purchaseToken</code>
</td>
<td>
Unique token identifying the pending transaction.
Use this to track or manage the pending update.
</td>
</tr>
</tbody>
</table>
</div>
</>
),
}}
Expand Down
Loading
Loading