BillingFlowParams.Builder

public static class BillingFlowParams.Builder
extends Object

java.lang.Object
   ↳ com.android.billingclient.api.BillingFlowParams.Builder


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

Summary

Public methods

BillingFlowParams build()

Returns BillingFlowParams reference to initiate a purchase flow.

BillingFlowParams.Builder setIsOfferPersonalized(boolean isOfferPersonalized)

Specifies whether the offer is personalized to the buyer.

BillingFlowParams.Builder setObfuscatedAccountId(String obfuscatedAccountid)

Specifies an optional obfuscated string that is uniquely associated with the user's account in your app.

BillingFlowParams.Builder setObfuscatedProfileId(String obfuscatedProfileId)

Specifies an optional obfuscated string that is uniquely associated with the user's profile in your app.

BillingFlowParams.Builder setProductDetailsParamsList(List<BillingFlowParams.ProductDetailsParams> productDetailsParamsList)

Specifies the BillingFlowParams.ProductDetailsParams of the items being purchased.

BillingFlowParams.Builder setSkuDetails(SkuDetails skuDetails)

This method is deprecated. Use setProductDetailsParamsList(List) instead.

BillingFlowParams.Builder setSubscriptionUpdateParams(BillingFlowParams.SubscriptionUpdateParams subscriptionUpdateParams)

Params used to upgrade or downgrade a subscription.

Inherited methods

Public methods

build

public BillingFlowParams build ()

Returns BillingFlowParams reference to initiate a purchase flow.

Returns
BillingFlowParams

setIsOfferPersonalized

public BillingFlowParams.Builder setIsOfferPersonalized (boolean isOfferPersonalized)

Specifies whether the offer is personalized to the buyer.

Parameters
isOfferPersonalized boolean

Returns
BillingFlowParams.Builder

setObfuscatedAccountId

public BillingFlowParams.Builder setObfuscatedAccountId (String obfuscatedAccountid)

Specifies an optional obfuscated string that is uniquely associated with the user's account in your app.

If you pass this value, Google Play can use it to detect irregular activity, such as many devices making purchases on the same account in a short period of time. Do not use this field to store any Personally Identifiable Information (PII) such as emails in cleartext. Attempting to store PII in this field will result in purchases being blocked. Google Play recommends that you use either encryption or a one-way hash to generate an obfuscated identifier to send to Google Play.

You can also retrieve this identifier via the Purchase object.

This identifier is limited to 64 characters.

Optional:

  • To buy in-app item
  • To create a new subscription
  • To replace an old subscription

Parameters
obfuscatedAccountid String

Returns
BillingFlowParams.Builder

setObfuscatedProfileId

public BillingFlowParams.Builder setObfuscatedProfileId (String obfuscatedProfileId)

Specifies an optional obfuscated string that is uniquely associated with the user's profile in your app.

Some applications allow users to have multiple profiles within a single account. Use this method to send the user's profile identifier to Google. Setting this field requests the user's obfuscated account id to be pass via setObfuscatedAccountId(String).

If you pass this value, Google Play can use it to detect irregular activity, such as many devices making purchases on the same account in a short period of time. Do not use this field to store any Personally Identifiable Information (PII) such as emails in cleartext. Attempting to store PII in this field will result in purchases being blocked. Google Play recommends that you use either encryption or a one-way hash to generate an obfuscated identifier to send to Google Play.

You can also retrieve this identifier via the Purchase object.

This identifier is limited to 64 characters.

Optional:

  • To buy in-app item
  • To create a new subscription
  • To replace an old subscription

Parameters
obfuscatedProfileId String

Returns
BillingFlowParams.Builder

setProductDetailsParamsList

public BillingFlowParams.Builder setProductDetailsParamsList (List<BillingFlowParams.ProductDetailsParams> productDetailsParamsList)

Specifies the BillingFlowParams.ProductDetailsParams of the items being purchased.

Parameters
productDetailsParamsList List

Returns
BillingFlowParams.Builder

setSkuDetails

public BillingFlowParams.Builder setSkuDetails (SkuDetails skuDetails)

This method is deprecated.
Use setProductDetailsParamsList(List) instead.

Specifies the SkuDetails of the item being purchased.

Mandatory:

  • To buy in-app item
  • To create a new subscription
  • To replace an old subscription

Parameters
skuDetails SkuDetails

Returns
BillingFlowParams.Builder

setSubscriptionUpdateParams

public BillingFlowParams.Builder setSubscriptionUpdateParams (BillingFlowParams.SubscriptionUpdateParams subscriptionUpdateParams)

Params used to upgrade or downgrade a subscription.

Mandatory:

  • To replace an old subscription

Parameters
subscriptionUpdateParams BillingFlowParams.SubscriptionUpdateParams

Returns
BillingFlowParams.Builder