Returns the pricing phases as a time ordered list of Pricing phase.
ProductDetails.PricingPhase
getBillingCycleCount() : Int
Number of cycles for which the billing period is applied.
getBillingPeriod() : String
Billing period for which the given price applies, specified in ISO 8601 format.
getFormattedPrice() : String
Returns formatted price for the payment cycle, including its currency sign.
getPriceAmountMicros() : Long
Returns the price for the payment cycle in micro-units, where 1,000,000 micro-units equal one unit of the currency.
getPriceCurrencyCode() : String
Returns ISO 4217 currency code for price.
getRecurrenceMode() : Int
Returns ProductDetails.RecurrenceMode for the pricing phase.
Making Purchases
Making Purchases, you have to call method:
/** * parameter1:activity,The context must be of type Activity * parameter2:productDetails,The ProductDetails object corresponding to the product * parameter3:offerToken,to get an offer token, call ProductDetails.subscriptionOfferDetails() for a list of * offers that are available to the user */Appflow.purchasePackage(activity: Activity, productDetails: ProductDetails, offerToken: String, listener: MakePurchaseListener)/** * parameter1:activity,The context must be of type Activity * parameter2:productDetails,The ProductDetails object corresponding to the product * Notice:The first offer token is used by default */Appflow.purchasePackage(activity: Activity, productDetails: ProductDetails, listener: MakePurchaseListener)
Example
Appflow.purchasePackage(activity, productDetails, offerToken, object : MakePurchaseListener{overridefunonCompleted(purchase: Purchase) {//After the purchase is successful, you can obtain the order id,//order token and other information through the Purchase object }overridefunonError(error: PurchasesError, userCancelled: Boolean) {//When userCancelled is true, it means that the user cancels the purchase; //when userCancelled is true, it means that the purchase fails//You can get specific failure information through PurchasesError }})
API Reference
Subscription Status
Get the subscription status of a product, you have to call method:
**To upgrade/downgrade a product, you have to call method:
/** * parameter1:activity,The context must be of type Activity * parameter2:packageToPurchase,The ProductDetails object corresponding to the product * parameter3:offerToken,to get an offer token, call ProductDetails.subscriptionOfferDetails() for a list of * offers that are available to the user * parameter4:upgradeInfo,Upgrade/Downgrade Product Information Object */Appflow.purchasePackage( activity: Activity, packageToPurchase: ProductDetails, offerToken: String, upgradeInfo: UpgradeInfo, listener: MakePurchaseListener )/** * parameter1:activity,The context must be of type Activity * parameter2:packageToPurchase,The ProductDetails object corresponding to the product * parameter3:upgradeInfo,Upgrade/Downgrade Product Information Object * Notice:The first offer token is used by default */Appflow.purchasePackage( activity: Activity, packageToPurchase: ProductDetails, upgradeInfo: UpgradeInfo, listener: MakePurchaseListener )