Skip to content

Most visited

Recently visited

navigation

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.Builder addOldSku(String oldSku)

Add the SKU that the user is upgrading or downgrading from.

BillingFlowParams build()

Returns BillingFlowParams reference to initiate a purchase flow.

BillingFlowParams.Builder setAccountId(String accountId)

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

BillingFlowParams.Builder setOldSkus(ArrayList<String> oldSkus)

Specify the SKU(s) that the user is upgrading or downgrading from.

BillingFlowParams.Builder setReplaceSkusProration(boolean bReplaceSkusProration)

Specify an optional flag indicating whether the user should be credited for any unused subscription time on the SKUs they are upgrading or downgrading.

BillingFlowParams.Builder setSku(String sku)

Specify the SKU that is being purchased or upgraded/downgraded to as published in the Google Developer console.

BillingFlowParams.Builder setType(String type)

Specify the billing type BillingClient.SkuType of the item being purchased.

BillingFlowParams.Builder setVrPurchaseFlow(boolean isVrPurchaseFlow)

Specify an optional flag indicating whether you wish to launch a VR purchase flow.

Inherited methods

From class java.lang.Object

Public methods

addOldSku

BillingFlowParams.Builder addOldSku (String oldSku)

Add the SKU that the user is upgrading or downgrading from.

Mandatory:

  • To replace an old subscription

Parameters
oldSku String

Returns
BillingFlowParams.Builder

build

BillingFlowParams build ()

Returns BillingFlowParams reference to initiate a purchase flow.

Returns
BillingFlowParams

setAccountId

BillingFlowParams.Builder setAccountId (String accountId)

Specify 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 the developer ID or the user's Google ID for this field. In addition, this field should not contain the user's ID in cleartext. We recommend that you use a one-way hash to generate a string from the user's ID and store the hashed string in this field.

Optional:

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

Parameters
accountId String

Returns
BillingFlowParams.Builder

setOldSkus

BillingFlowParams.Builder setOldSkus (ArrayList<String> oldSkus)

Specify the SKU(s) that the user is upgrading or downgrading from.

Mandatory:

  • To replace an old subscription

Parameters
oldSkus ArrayList

Returns
BillingFlowParams.Builder

setReplaceSkusProration

BillingFlowParams.Builder setReplaceSkusProration (boolean bReplaceSkusProration)

Specify an optional flag indicating whether the user should be credited for any unused subscription time on the SKUs they are upgrading or downgrading.

If you set this field to false, the user does not receive credit for any unused subscription time and the recurrence date does not change. Otherwise, Google Play swaps out the old SKUs and credits the user with the unused value of their subscription time on a pro-rated basis. Google Play applies this credit to the new subscription, and does not begin billing the user for the new subscription until after the credit is used up.

Optional:

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

Parameters
bReplaceSkusProration boolean

Returns
BillingFlowParams.Builder

setSku

BillingFlowParams.Builder setSku (String sku)

Specify the SKU that is being purchased or upgraded/downgraded to as published in the Google Developer console.

Mandatory:

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

Parameters
sku String

Returns
BillingFlowParams.Builder

setType

BillingFlowParams.Builder setType (String type)

Specify the billing type BillingClient.SkuType of the item being purchased.

Mandatory:

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

Parameters
type String

Returns
BillingFlowParams.Builder

setVrPurchaseFlow

BillingFlowParams.Builder setVrPurchaseFlow (boolean isVrPurchaseFlow)

Specify an optional flag indicating whether you wish to launch a VR purchase flow.

Optional:

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

Parameters
isVrPurchaseFlow boolean

Returns
BillingFlowParams.Builder

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)