Purchases
SDK configuration to send purchases info to Appflow.ai
This part of SDK is important for subscriptions information
Ready to work Configure product information in Google Play
Displaying Products
To fetch the products, you have to call method:
/**
* parameter1:skus,The product id list
*/
Appflow.getSkuDetails(skus: List<String>, listener: SkuDetailsListener)Example
val skus = listOf("SKU_WEEKLY", "SKU_MONTHLY", "SKU_YEARLY")
Appflow.getSkuDetails(skus, object : SkuDetailsListener {
override fun onError(error: PurchasesError) {}
override fun onReceived(map: HashMap<String, ProductDetails>) {
for (product in map) {
val skuDetails = product.value
Log.d(TAG,"productId:${skuDetails.productId}")
Log.d(TAG,"title:${skuDetails.title}")
Log.d(TAG,"description:${skuDetails.description}")
Log.d(TAG,"name:${skuDetails.name}")
Log.d(TAG,"subscriptionOfferDetails:${skuDetails.subscriptionOfferDetails}")
}
}
})API Reference
onReceived(map: HashMap<String, ProductDetails>)
Success callback
onError(error : PurchasesError)
Failure callback
code
error code
message
error message
getDescription() : String
Returns the description of the product.
getName() : String
Returns the name of the product being sold.
getProductId() : String
Returns the product's Id.
getProductType() : String
Returns the BillingClient.ProductType of the product.
getTitle() : String
Returns the title of the product being sold.
getOneTimePurchaseOfferDetails : ProductDetails.OneTimePurchaseOfferDetails
eturns the offer details of an one-time purchase product.
getSubscriptionOfferDetails() : List<ProductDetails.SubscriptionOfferDetails>
returns a list containing all available offers to purchase a subscription product.
INAPP
A type of SKU for Android apps in-app products
SUBS
A type of SKU for Android apps subscriptions
getFormattedPrice() : String
Returns formatted price for the payment, including its currency sign.
getPriceAmountMicros() : Long
Returns the price for the payment in micro-units, where 1,000,000 micro-units equal one unit of the currency.
getPriceCurrencyCode() : String
Returns ISO 4217 currency code for price.
getBasePlanId() : String
Returns the base plan id associated with the subscription product.
getOfferId() : String
Returns the offer id associated with the subscription product.
getOfferTags() : List
Returns the offer tags associated with this Subscription Offer.
getOfferToken() : String
Returns the offer token required to pass in launchBillingFlow to purchase the subscription product with these pricing phases.
getPricingPhases() : ProductDetails.PricingPhases
Returns the pricing phases for the subscription product.
getPricingPhaseList() : List<ProductDetails.PricingPhase>
Returns the pricing phases as a time ordered list of Pricing phase.
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:
Example
API Reference

Subscription Status
Get the subscription status of a product, you have to call method:
Example
API Reference

Upgrade/Downgrade product
**To upgrade/downgrade a product, you have to call method:
Example
API Reference

Last updated
Was this helpful?