Improved API docs. Recurrence mode

This commit is contained in:
Björn Ritzl 2022-09-08 10:06:10 +02:00
parent c09aa64ab5
commit 52493d8c83
2 changed files with 46 additions and 1 deletions

View File

@ -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

View File

@ -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);
}
}