TransactionInfo.Builder
Stay organized with collections
Save and categorize content based on your preferences.
Inherited Method Summary
From class java.lang.Object
Public Methods
Returns the actual TransactionInfo
created using the data passed to the Builder object.
Sets the ISO 4217 alphabetic currency code of the transaction.
This is a required field.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eTransactionInfo.Builder\u003c/code\u003e helps create \u003ccode\u003eTransactionInfo\u003c/code\u003e objects for Google Wallet integration.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to set the currency code, total price, and total price status of a transaction.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003esetCurrencyCode()\u003c/code\u003e, \u003ccode\u003esetTotalPrice()\u003c/code\u003e, and \u003ccode\u003esetTotalPriceStatus()\u003c/code\u003e are key methods for building transaction information.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ebuild()\u003c/code\u003e method creates the final \u003ccode\u003eTransactionInfo\u003c/code\u003e object using the provided data.\u003c/p\u003e\n"]]],["The `TransactionInfo.Builder` class is used to construct `TransactionInfo` objects. Key actions include setting the transaction's currency code using `setCurrencyCode()`, which is mandatory. You can also set the total price of the transaction with `setTotalPrice()`, required if the status is estimated or final. The `setTotalPriceStatus()` method sets the total price status, which is also required. The `build()` method finalizes and returns the constructed `TransactionInfo` object.\n"],null,["# TransactionInfo.Builder\n\npublic final class **TransactionInfo.Builder** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nBuilder to create a [TransactionInfo](/android/reference/com/google/android/gms/wallet/TransactionInfo). \n\n### Public Method Summary\n\n|-----------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [TransactionInfo](/android/reference/com/google/android/gms/wallet/TransactionInfo) | [build](/android/reference/com/google/android/gms/wallet/TransactionInfo.Builder#build())() Returns the actual [TransactionInfo](/android/reference/com/google/android/gms/wallet/TransactionInfo) created using the data passed to the Builder object. |\n| [TransactionInfo.Builder](/android/reference/com/google/android/gms/wallet/TransactionInfo.Builder) | [setCurrencyCode](/android/reference/com/google/android/gms/wallet/TransactionInfo.Builder#setCurrencyCode(java.lang.String))([String](//developer.android.com/reference/java/lang/String.html) currencyCode) Sets the ISO 4217 alphabetic currency code of the transaction. |\n| [TransactionInfo.Builder](/android/reference/com/google/android/gms/wallet/TransactionInfo.Builder) | [setTotalPrice](/android/reference/com/google/android/gms/wallet/TransactionInfo.Builder#setTotalPrice(java.lang.String))([String](//developer.android.com/reference/java/lang/String.html) totalPrice) Sets the total price of this transaction. |\n| [TransactionInfo.Builder](/android/reference/com/google/android/gms/wallet/TransactionInfo.Builder) | [setTotalPriceStatus](/android/reference/com/google/android/gms/wallet/TransactionInfo.Builder#setTotalPriceStatus(int))(int totalPriceStatus) Sets the status of this transaction's total price. |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Methods\n--------------\n\n#### public [TransactionInfo](/android/reference/com/google/android/gms/wallet/TransactionInfo)\n**build** ()\n\nReturns the actual [TransactionInfo](/android/reference/com/google/android/gms/wallet/TransactionInfo)\ncreated using the data passed to the Builder object. \n\n#### public [TransactionInfo.Builder](/android/reference/com/google/android/gms/wallet/TransactionInfo.Builder)\n**setCurrencyCode** ([String](//developer.android.com/reference/java/lang/String.html) currencyCode)\n\nSets the ISO 4217 alphabetic currency code of the transaction.\n\nThis is a required field. \n\n#### public [TransactionInfo.Builder](/android/reference/com/google/android/gms/wallet/TransactionInfo.Builder)\n**setTotalPrice** ([String](//developer.android.com/reference/java/lang/String.html) totalPrice)\n\nSets the total price of this transaction. The format of this string should follow\nthe regex format: \\[0-9\\]+(\\\\.\\[0-9\\]\\[0-9\\])? (e.g., \"10.45\")\n\nThis field is required if total price status is set to [WalletConstants.TOTAL_PRICE_STATUS_ESTIMATED](/android/reference/com/google/android/gms/wallet/WalletConstants#TOTAL_PRICE_STATUS_ESTIMATED) or [WalletConstants.TOTAL_PRICE_STATUS_FINAL](/android/reference/com/google/android/gms/wallet/WalletConstants#TOTAL_PRICE_STATUS_FINAL). \n\n#### public [TransactionInfo.Builder](/android/reference/com/google/android/gms/wallet/TransactionInfo.Builder)\n**setTotalPriceStatus** (int totalPriceStatus)\n\nSets the status of this transaction's total price. See [WalletConstants.TotalPriceStatus](/android/reference/com/google/android/gms/wallet/WalletConstants.TotalPriceStatus) for available options.\n\nThis is a required field."]]