diff --git a/extension-iap/api/iap.script_api b/extension-iap/api/iap.script_api index e4a1873..124f718 100644 --- a/extension-iap/api/iap.script_api +++ b/extension-iap/api/iap.script_api @@ -149,6 +149,39 @@ type: table desc: [icon:googleplay] List of subscription offers. Each offer contains a token and a list of price and billing options. + See https://developer.android.com/reference/com/android/billingclient/api/ProductDetails.PricingPhase + members: + - name: token + type: string + desc: The token associated with the pricing phases for the subscription. + + - name: pricing + type: table + desc: The pricing phases for the subscription. + members: + - name: price_string + type: string + desc: Formatted price for the payment cycle, including currency sign. + + - name: price + type: number + desc: Price of the payment cycle in micro-units. + + - name: currency_code + type: string + desc: ISO 4217 currency code + + - name: billing_period + type: string + desc: Billing period of the payment cycle, specified in ISO 8601 format + + - name: billing_cycle_count + type: number + desc: Number of cycles for which the billing period is applied. + + - name: recurrence_mode + type: string + desc: FININTE, INFINITE or NONE - name: error type: table diff --git a/extension-iap/src/java/com/defold/iap/IapGooglePlay.java b/extension-iap/src/java/com/defold/iap/IapGooglePlay.java index c9992c5..22c1a36 100644 --- a/extension-iap/src/java/com/defold/iap/IapGooglePlay.java +++ b/extension-iap/src/java/com/defold/iap/IapGooglePlay.java @@ -27,6 +27,7 @@ import com.android.billingclient.api.ProductDetails; import com.android.billingclient.api.ProductDetails.OneTimePurchaseOfferDetails; import com.android.billingclient.api.ProductDetails.PricingPhases; import com.android.billingclient.api.ProductDetails.PricingPhase; +import com.android.billingclient.api.ProductDetails.RecurrenceMode; import com.android.billingclient.api.ProductDetails.SubscriptionOfferDetails; import com.android.billingclient.api.ConsumeParams; import com.android.billingclient.api.BillingFlowParams; @@ -128,7 +129,18 @@ public class IapGooglePlay implements PurchasesUpdatedListener { o.put("currency_code", pricingPhase.getPriceCurrencyCode()); o.put("billing_period", pricingPhase.getBillingPeriod()); o.put("billing_cycle_count", pricingPhase.getBillingCycleCount()); - o.put("recurrence_mode", pricingPhase.getRecurrenceMode()); + switch (pricingPhase.getRecurrenceMode()) { + case RecurrenceMode.FINITE_RECURRING: + o.put("recurrence_mode", "FINITE"); + break; + case RecurrenceMode.INFINITE_RECURRING: + o.put("recurrence_mode", "INFINITE"); + break; + default: + case RecurrenceMode.NON_RECURRING: + o.put("recurrence_mode", "NONE"); + break; + } a.put(o); } }