API reference

BillingFlowParams Class

Modifiers: final
Parameters to initiate a purchase flow. See BillingClient.launchBillingFlow.
The equivalent Google Play Billing Library class can be found at the Android developer documentation for BillingFlowParams.

Signature

data class BillingFlowParams(val obfuscatedAccountId: String? = null, val obfuscatedProfileId: String? = null, val isOfferPersonalized: Boolean = false, val productDetailsParamsList: List<BillingFlowParams.ProductDetailsParams> = emptyList(), val subscriptionUpdateParams: BillingFlowParams.SubscriptionUpdateParams? = null, val skuDetails: SkuDetails? = null)

Constructors

BillingFlowParams ( obfuscatedAccountId , obfuscatedProfileId , isOfferPersonalized , productDetailsParamsList , subscriptionUpdateParams , skuDetails )
Signature
constructor(obfuscatedAccountId: String? = null, obfuscatedProfileId: String? = null, isOfferPersonalized: Boolean = false, productDetailsParamsList: List<BillingFlowParams.ProductDetailsParams> = emptyList(), subscriptionUpdateParams: BillingFlowParams.SubscriptionUpdateParams? = null, skuDetails: SkuDetails? = null)
Parameters
obfuscatedAccountId: String?
obfuscatedProfileId: String?
isOfferPersonalized: Boolean
productDetailsParamsList: List
subscriptionUpdateParams: BillingFlowParams.SubscriptionUpdateParams?
skuDetails: SkuDetails?

Properties

isOfferPersonalized : Boolean
[Get]
Signature
val isOfferPersonalized: Boolean = false
obfuscatedAccountId : String?
[Get]
Signature
val obfuscatedAccountId: String? = null
obfuscatedProfileId : String?
[Get]
Signature
val obfuscatedProfileId: String? = null
productDetailsParamsList : List
[Get]
Signature
val productDetailsParamsList: List<BillingFlowParams.ProductDetailsParams>
skuDetails : SkuDetails?
[Get]
DeprecatedUse [ProductDetailsParams] instead
Signature
val skuDetails: SkuDetails? = null
subscriptionUpdateParams : BillingFlowParams.SubscriptionUpdateParams?
[Get]
Signature
val subscriptionUpdateParams: BillingFlowParams.SubscriptionUpdateParams? = null

Companion Object

Companion Object Properties

EXTRA_PARAM_KEY_ACCOUNT_ID : String
[Get]
Signature
const val EXTRA_PARAM_KEY_ACCOUNT_ID: String

Companion Object Functions

newBuilder ()
Signature
fun newBuilder(): BillingFlowParams.Builder
Returns
BillingFlowParams.Builder

Inner Classes

Builder Class

Modifiers: final
Helps to construct BillingFlowParams that are used to initiate a purchase flow.

Signature

class Builder

Functions

build ()
Returns BillingFlowParams reference to initiate a purchase flow.
Signature
fun build(): BillingFlowParams
setIsOfferPersonalized ( isOfferPersonalized )
Specifies whether the offer is personalized to the buyer.
Signature
fun setIsOfferPersonalized(isOfferPersonalized: Boolean): BillingFlowParams.Builder
Parameters
isOfferPersonalized: Boolean
Returns
BillingFlowParams.Builder
setObfuscatedAccountId ( obfuscatedAccountId )
Specifies an optional obfuscated string that is uniquely associated with the user's account in your app.
Signature
fun setObfuscatedAccountId(obfuscatedAccountId: String): BillingFlowParams.Builder
Parameters
obfuscatedAccountId: String
Returns
BillingFlowParams.Builder
setObfuscatedProfileId ( obfuscatedProfileId )
Specifies an optional obfuscated string that is uniquely associated with the user's profile in your app.
Signature
fun setObfuscatedProfileId(obfuscatedProfileId: String): BillingFlowParams.Builder
Parameters
obfuscatedProfileId: String
Returns
BillingFlowParams.Builder
setProductDetailsParamsList ( productDetailsParamsList )
Specifies the BillingFlowParams.ProductDetailsParams of the items being purchased.
Signature
fun setProductDetailsParamsList(productDetailsParamsList: List<BillingFlowParams.ProductDetailsParams>): BillingFlowParams.Builder
Parameters
productDetailsParamsList: List
Returns
BillingFlowParams.Builder
setSkuDetails ( skuDetails )
DeprecatedUse [setProductDetailsParamsList] instead.
Signature
fun setSkuDetails(skuDetails: SkuDetails?): BillingFlowParams.Builder
Parameters
skuDetails: SkuDetails?
Returns
BillingFlowParams.Builder
setSubscriptionUpdateParams ( subscriptionUpdateParams )
Params used to upgrade or downgrade a subscription.
Signature
fun setSubscriptionUpdateParams(subscriptionUpdateParams: BillingFlowParams.SubscriptionUpdateParams): BillingFlowParams.Builder
Parameters
subscriptionUpdateParams: BillingFlowParams.SubscriptionUpdateParams
Returns
BillingFlowParams.Builder

ProductDetailsParams Class

Modifiers: final

Companion Object

Companion Object Functions
newBuilder ()
Signature
fun newBuilder(): BillingFlowParams.ProductDetailsParams.Builder
Returns
BillingFlowParams.ProductDetailsParams.Builder

Inner Class

Builder Class

Modifiers: final

Signature

class Builder

Functions

build ()
Signature
fun build(): BillingFlowParams.ProductDetailsParams
Returns
BillingFlowParams.ProductDetailsParams
setOfferToken ( offerToken )
Specifies the identifier of the offer to initiate purchase with. Do not call this method for One-time products.
A subscriptions product may be associated with multiple offers. To identify offers a user is eligible for, call BillingClient.queryProductDetailsAsync, which returns all eligible offers and as part of SubscriptionOfferDetails#getOfferToken. Use this method to specify which offer the user would like to purchase. This method should not be called for One-time products.
Signature
fun setOfferToken(offerToken: String): BillingFlowParams.ProductDetailsParams.Builder
Parameters
offerToken: String
Returns
BillingFlowParams.ProductDetailsParams.Builder
setProductDetails ( productDetails )
Specifies the details of item to be purchased, fetched via BillingClient.queryProductDetailsAsync.
Signature
fun setProductDetails(productDetails: ProductDetails): BillingFlowParams.ProductDetailsParams.Builder
Parameters
productDetails: ProductDetails
Returns
BillingFlowParams.ProductDetailsParams.Builder
Params that describe the product to be purchased and the offer to purchase with.

Signature

data class ProductDetailsParams(val productDetails: ProductDetails, val offerToken: String? = null)

Constructors

ProductDetailsParams ( productDetails , offerToken )
Signature
constructor(productDetails: ProductDetails, offerToken: String? = null)
Parameters
productDetails: ProductDetails
offerToken: String?
Returns
BillingFlowParams.ProductDetailsParams

Properties

offerToken : String?
[Get]
Signature
val offerToken: String? = null
productDetails : ProductDetails
[Get]
Signature
val productDetails: ProductDetails

SubscriptionUpdateParams Class

Modifiers: final

Companion Object

Companion Object Functions
newBuilder ()
Signature
fun newBuilder(): BillingFlowParams.SubscriptionUpdateParams.Builder
Returns
BillingFlowParams.SubscriptionUpdateParams.Builder

Inner Class

Builder Class

Modifiers: final

Signature

class Builder

Functions

build ()
Signature
fun build(): BillingFlowParams.SubscriptionUpdateParams
Returns
BillingFlowParams.SubscriptionUpdateParams
setOldPurchaseToken ( purchaseToken )
Specifies the purchase token that the user is upgrading or downgrading from.
Signature
fun setOldPurchaseToken(purchaseToken: String): BillingFlowParams.SubscriptionUpdateParams.Builder
Parameters
purchaseToken: String
Returns
BillingFlowParams.SubscriptionUpdateParams.Builder
setOldSkuPurchaseToken ( skuPurchaseToken )
DeprecatedThis is a deprecated API that was removed in Play Billing Library version 6.0.0. Use [setOldPurchaseToken] instead.
This deprecated API will call set the old purchase token via BillingFlowParams.SubscriptionUpdateParams.Builder.setOldPurchaseToken.
Signature
fun setOldSkuPurchaseToken(skuPurchaseToken: String): BillingFlowParams.SubscriptionUpdateParams.Builder
Parameters
skuPurchaseToken: String
Returns
BillingFlowParams.SubscriptionUpdateParams.Builder
setOriginalExternalTransactionId ( externalTransactionId )
If the originating transaction for the subscription that the user is upgrading or downgrading from was processed via alternative billing, specifies the external transaction id of the originating subscription.
Signature
fun setOriginalExternalTransactionId(externalTransactionId: String): BillingFlowParams.SubscriptionUpdateParams.Builder
Parameters
externalTransactionId: String
Returns
BillingFlowParams.SubscriptionUpdateParams.Builder
setReplaceProrationMode ( prorationMode )
DeprecatedThis is a deprecated API that was removed in Play Billing Library version 6.0.0. Use [setSubscriptionReplacementMode] instead.
Signature
fun setReplaceProrationMode(prorationMode: Int): BillingFlowParams.SubscriptionUpdateParams.Builder
Parameters
prorationMode: Int
Returns
BillingFlowParams.SubscriptionUpdateParams.Builder
setReplaceSkusProrationMode ( prorationMode )
DeprecatedThis is a deprecated API that was removed in Play Billing Library version 6.0.0. Use [setSubscriptionReplacementMode] instead.
Signature
fun setReplaceSkusProrationMode(prorationMode: Int): BillingFlowParams.SubscriptionUpdateParams.Builder
Parameters
prorationMode: Int
Returns
BillingFlowParams.SubscriptionUpdateParams.Builder
setSubscriptionReplacementMode ( subscriptionReplacementMode )
Specifies the ReplacementMode for replacement.
Signature
fun setSubscriptionReplacementMode(subscriptionReplacementMode: Int): BillingFlowParams.SubscriptionUpdateParams.Builder
Parameters
subscriptionReplacementMode: Int
Returns
BillingFlowParams.SubscriptionUpdateParams.Builder

Inner Annotation

ReplacementMode Annotation

Supported replacement modes to replace an existing subscription with a new one.

Signature

annotation class ReplacementMode

Constructors

ReplacementMode ()
Signature
constructor()
Returns
BillingFlowParams.SubscriptionUpdateParams.ReplacementMode

Companion Object

Companion Object Properties
CHARGE_FULL_PRICE : Int
[Get]
The new plan takes effect immediately, and the user is charged full price of new plan and is given a full billing cycle of subscription, plus remaining prorated time from the old plan.
Signature
const val CHARGE_FULL_PRICE: Int = 5
CHARGE_PRORATED_PRICE : Int
[Get]
The new plan takes effect immediately, and the billing cycle remains the same.
Signature
const val CHARGE_PRORATED_PRICE: Int = 2
DEFERRED : Int
[Get]
The new purchase takes effect immediately, the new plan will take effect when the old item expires.
Signature
const val DEFERRED: Int = 6
UNKNOWN_REPLACEMENT_MODE : Int
[Get]
Signature
const val UNKNOWN_REPLACEMENT_MODE: Int = 0
WITH_TIME_PRORATION : Int
[Get]
Signature
const val WITH_TIME_PRORATION: Int = 1
WITHOUT_PRORATION : Int
[Get]
The new plan takes effect immediately, and the new price will be charged on next recurrence time.
Signature
const val WITHOUT_PRORATION: Int = 3
Params that describe a subscription update.

Signature

class SubscriptionUpdateParams(oldPurchaseToken: String? = null, externalTransactionId: String? = null, subscriptionReplacementMode: Int? = null)

Constructors

SubscriptionUpdateParams ( oldPurchaseToken , externalTransactionId , subscriptionReplacementMode )
Signature
constructor(oldPurchaseToken: String? = null, externalTransactionId: String? = null, subscriptionReplacementMode: Int? = null)
Parameters
oldPurchaseToken: String?
externalTransactionId: String?
subscriptionReplacementMode: Int?
Returns
BillingFlowParams.SubscriptionUpdateParams

Inner Annotation

ProrationMode Annotation

DeprecatedUse [SubscriptionUpdateParams.ReplacementMode] instead.
Replace SKU ProrationMode.

Signature

annotation class ProrationMode

Constructors

ProrationMode ()
Signature
constructor()
Returns
BillingFlowParams.ProrationMode

Companion Object

Companion Object Properties
DEFERRED : Int
[Get]
Replacement takes effect when the old plan expires, and the new price will be charged at the same time.
Signature
const val DEFERRED: Int = 4
IMMEDIATE_AND_CHARGE_FULL_PRICE : Int
[Get]
Replacement takes effect immediately, and the user is charged full price of new plan and is given a full billing cycle of subscription, plus remaining prorated time from the old plan.
Signature
const val IMMEDIATE_AND_CHARGE_FULL_PRICE: Int = 5
IMMEDIATE_AND_CHARGE_PRORATED_PRICE : Int
[Get]
Replacement takes effect immediately, and the billing cycle remains the same.
Signature
const val IMMEDIATE_AND_CHARGE_PRORATED_PRICE: Int = 2
IMMEDIATE_WITH_TIME_PRORATION : Int
[Get]
Replacement takes effect immediately, and the remaining time will be prorated and credited to the user.
Signature
const val IMMEDIATE_WITH_TIME_PRORATION: Int = 1
IMMEDIATE_WITHOUT_PRORATION : Int
[Get]
Replacement takes effect immediately, and the new price will be charged on next recurrence time.
Signature
const val IMMEDIATE_WITHOUT_PRORATION: Int = 3
UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY : Int
[Get]
Signature
const val UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY: Int = 0
Did you find this page helpful?