Reference documentation and code samples for the Google Cloud Retail V2 Client class PurchaseTransaction.
A transaction represents the entire purchase transaction.
Generated from protobuf messagegoogle.cloud.retail.v2.PurchaseTransaction
Namespace
Google \ Cloud \ Retail \ V2
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ id
string
The transaction ID with a length limit of 128 characters.
↳ revenue
float
Required. Total non-zero revenue or grand total associated with the transaction. This value include shipping, tax, or other adjustments to total revenue that you want to include as part of your revenue calculations.
↳ tax
float
All the taxes associated with the transaction.
↳ cost
float
All the costs associated with the products. These can be manufacturing costs, shipping expenses not borne by the end user, or any other costs, such that: * * Profit =revenue-tax-cost
↳ currency_code
string
Required. Currency code. Use three-character ISO-4217 code.
getId
The transaction ID with a length limit of 128 characters.
Returns
Type
Description
string
setId
The transaction ID with a length limit of 128 characters.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getRevenue
Required. Total non-zero revenue or grand total associated with the
transaction. This value include shipping, tax, or other adjustments to
total revenue that you want to include as part of your revenue
calculations.
Returns
Type
Description
float
setRevenue
Required. Total non-zero revenue or grand total associated with the
transaction. This value include shipping, tax, or other adjustments to
total revenue that you want to include as part of your revenue
calculations.
Parameter
Name
Description
var
float
Returns
Type
Description
$this
getTax
All the taxes associated with the transaction.
Returns
Type
Description
float
setTax
All the taxes associated with the transaction.
Parameter
Name
Description
var
float
Returns
Type
Description
$this
getCost
All the costs associated with the products. These can be manufacturing
costs, shipping expenses not borne by the end user, or any other costs,
such that:
All the costs associated with the products. These can be manufacturing
costs, shipping expenses not borne by the end user, or any other costs,
such that:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Google Cloud Retail V2 Client - Class PurchaseTransaction (2.3.1)\n\nVersion latestkeyboard_arrow_down\n\n- [2.3.1 (latest)](/php/docs/reference/cloud-retail/latest/V2.PurchaseTransaction)\n- [2.3.0](/php/docs/reference/cloud-retail/2.3.0/V2.PurchaseTransaction)\n- [2.2.1](/php/docs/reference/cloud-retail/2.2.1/V2.PurchaseTransaction)\n- [2.1.3](/php/docs/reference/cloud-retail/2.1.3/V2.PurchaseTransaction)\n- [2.0.0](/php/docs/reference/cloud-retail/2.0.0/V2.PurchaseTransaction)\n- [1.7.0](/php/docs/reference/cloud-retail/1.7.0/V2.PurchaseTransaction)\n- [1.6.4](/php/docs/reference/cloud-retail/1.6.4/V2.PurchaseTransaction)\n- [1.5.0](/php/docs/reference/cloud-retail/1.5.0/V2.PurchaseTransaction)\n- [1.4.2](/php/docs/reference/cloud-retail/1.4.2/V2.PurchaseTransaction)\n- [1.3.1](/php/docs/reference/cloud-retail/1.3.1/V2.PurchaseTransaction)\n- [1.2.1](/php/docs/reference/cloud-retail/1.2.1/V2.PurchaseTransaction)\n- [1.1.1](/php/docs/reference/cloud-retail/1.1.1/V2.PurchaseTransaction)\n- [1.0.1](/php/docs/reference/cloud-retail/1.0.1/V2.PurchaseTransaction) \nReference documentation and code samples for the Google Cloud Retail V2 Client class PurchaseTransaction.\n\nA transaction represents the entire purchase transaction.\n\nGenerated from protobuf message `google.cloud.retail.v2.PurchaseTransaction`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Retail \\\\ V2\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getId\n\nThe transaction ID with a length limit of 128 characters.\n\n### setId\n\nThe transaction ID with a length limit of 128 characters.\n\n### getRevenue\n\nRequired. Total non-zero revenue or grand total associated with the\ntransaction. This value include shipping, tax, or other adjustments to\ntotal revenue that you want to include as part of your revenue\ncalculations.\n\n### setRevenue\n\nRequired. Total non-zero revenue or grand total associated with the\ntransaction. This value include shipping, tax, or other adjustments to\ntotal revenue that you want to include as part of your revenue\ncalculations.\n\n### getTax\n\nAll the taxes associated with the transaction.\n\n### setTax\n\nAll the taxes associated with the transaction.\n\n### getCost\n\nAll the costs associated with the products. These can be manufacturing\ncosts, shipping expenses not borne by the end user, or any other costs,\nsuch that:\n\n- Profit = [revenue](/php/docs/reference/cloud-retail/latest/V2.PurchaseTransaction#_Google_Cloud_Retail_V2_PurchaseTransaction__getRevenue__) - [tax](/php/docs/reference/cloud-retail/latest/V2.PurchaseTransaction#_Google_Cloud_Retail_V2_PurchaseTransaction__getTax__) - [cost](/php/docs/reference/cloud-retail/latest/V2.PurchaseTransaction#_Google_Cloud_Retail_V2_PurchaseTransaction__getCost__)\n\n### setCost\n\nAll the costs associated with the products. These can be manufacturing\ncosts, shipping expenses not borne by the end user, or any other costs,\nsuch that:\n\n- Profit = [revenue](/php/docs/reference/cloud-retail/latest/V2.PurchaseTransaction#_Google_Cloud_Retail_V2_PurchaseTransaction__getRevenue__) - [tax](/php/docs/reference/cloud-retail/latest/V2.PurchaseTransaction#_Google_Cloud_Retail_V2_PurchaseTransaction__getTax__) - [cost](/php/docs/reference/cloud-retail/latest/V2.PurchaseTransaction#_Google_Cloud_Retail_V2_PurchaseTransaction__getCost__)\n\n### getCurrencyCode\n\nRequired. Currency code. Use three-character ISO-4217 code.\n\n### setCurrencyCode\n\nRequired. Currency code. Use three-character ISO-4217 code."]]