Reference documentation and code samples for the Recommendations AI V1beta1 API class Google::Cloud::RecommendationEngine::V1beta1::PurchaseTransaction.
A transaction represents the entire purchase transaction.
(::Google::Protobuf::Map{::String => ::Float}) — Optional. All the costs associated with the product. These can be
manufacturing costs, shipping expenses not borne by the end user, or any
other costs.
Total product cost such that
profit = revenue - (sum(taxes) + sum(costs))
If product_cost is not set, then
profit = revenue - tax - shipping - sum(CatalogItem.costs).
If CatalogItem.cost is not specified for one of the items, CatalogItem.cost
based profit cannot be calculated for this Transaction.
value (::Google::Protobuf::Map{::String => ::Float}) — Optional. All the costs associated with the product. These can be
manufacturing costs, shipping expenses not borne by the end user, or any
other costs.
Total product cost such that
profit = revenue - (sum(taxes) + sum(costs))
If product_cost is not set, then
profit = revenue - tax - shipping - sum(CatalogItem.costs).
If CatalogItem.cost is not specified for one of the items, CatalogItem.cost
based profit cannot be calculated for this Transaction.
Returns
(::Google::Protobuf::Map{::String => ::Float}) — Optional. All the costs associated with the product. These can be
manufacturing costs, shipping expenses not borne by the end user, or any
other costs.
Total product cost such that
profit = revenue - (sum(taxes) + sum(costs))
If product_cost is not set, then
profit = revenue - tax - shipping - sum(CatalogItem.costs).
If CatalogItem.cost is not specified for one of the items, CatalogItem.cost
based profit cannot be calculated for this Transaction.
#currency_code
defcurrency_code()->::String
Returns
(::String) — Required. Currency code. Use three-character ISO-4217 code. This field
is not required if the event type is refund.
#currency_code=
defcurrency_code=(value)->::String
Parameter
value (::String) — Required. Currency code. Use three-character ISO-4217 code. This field
is not required if the event type is refund.
Returns
(::String) — Required. Currency code. Use three-character ISO-4217 code. This field
is not required if the event type is refund.
#id
defid()->::String
Returns
(::String) — Optional. The transaction ID with a length limit of 128 bytes.
#id=
defid=(value)->::String
Parameter
value (::String) — Optional. The transaction ID with a length limit of 128 bytes.
Returns
(::String) — Optional. The transaction ID with a length limit of 128 bytes.
#revenue
defrevenue()->::Float
Returns
(::Float) — Required. Total 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. This field
is not required if the event type is refund.
#revenue=
defrevenue=(value)->::Float
Parameter
value (::Float) — Required. Total 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. This field
is not required if the event type is refund.
Returns
(::Float) — Required. Total 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. This field
is not required if the event type is refund.
[[["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-08-28 UTC."],[],[],null,["# Recommendations AI V1beta1 API - Class Google::Cloud::RecommendationEngine::V1beta1::PurchaseTransaction (v0.13.0)\n\nVersion latestkeyboard_arrow_down\n\n- [0.13.0 (latest)](/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/Google-Cloud-RecommendationEngine-V1beta1-PurchaseTransaction)\n- [0.12.1](/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/0.12.1/Google-Cloud-RecommendationEngine-V1beta1-PurchaseTransaction)\n- [0.11.0](/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/0.11.0/Google-Cloud-RecommendationEngine-V1beta1-PurchaseTransaction)\n- [0.10.0](/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/0.10.0/Google-Cloud-RecommendationEngine-V1beta1-PurchaseTransaction)\n- [0.9.2](/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/0.9.2/Google-Cloud-RecommendationEngine-V1beta1-PurchaseTransaction)\n- [0.8.2](/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/0.8.2/Google-Cloud-RecommendationEngine-V1beta1-PurchaseTransaction)\n- [0.7.0](/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/0.7.0/Google-Cloud-RecommendationEngine-V1beta1-PurchaseTransaction)\n- [0.6.1](/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/0.6.1/Google-Cloud-RecommendationEngine-V1beta1-PurchaseTransaction)\n- [0.5.0](/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/0.5.0/Google-Cloud-RecommendationEngine-V1beta1-PurchaseTransaction)\n- [0.4.1](/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/0.4.1/Google-Cloud-RecommendationEngine-V1beta1-PurchaseTransaction)\n- [0.3.7](/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/0.3.7/Google-Cloud-RecommendationEngine-V1beta1-PurchaseTransaction) \nReference documentation and code samples for the Recommendations AI V1beta1 API class Google::Cloud::RecommendationEngine::V1beta1::PurchaseTransaction.\n\nA transaction represents the entire purchase transaction. \n\nInherits\n--------\n\n- Object \n\nExtended By\n-----------\n\n- Google::Protobuf::MessageExts::ClassMethods \n\nIncludes\n--------\n\n- Google::Protobuf::MessageExts\n\nMethods\n-------\n\n### #costs\n\n def costs() -\u003e ::Google::Protobuf::Map{::String =\u003e ::Float}\n\n**Returns**\n\n- (::Google::Protobuf::Map{::String =\\\u003e ::Float}) --- Optional. All the costs associated with the product. These can be manufacturing costs, shipping expenses not borne by the end user, or any other costs.\n\n Total product cost such that\n profit = revenue - (sum(taxes) + sum(costs))\n If product_cost is not set, then\n profit = revenue - tax - shipping - sum(CatalogItem.costs).\n\n If CatalogItem.cost is not specified for one of the items, CatalogItem.cost\n based profit *cannot* be calculated for this Transaction.\n\n### #costs=\n\n def costs=(value) -\u003e ::Google::Protobuf::Map{::String =\u003e ::Float}\n\n**Parameter**\n\n- **value** (::Google::Protobuf::Map{::String =\\\u003e ::Float}) --- Optional. All the costs associated with the product. These can be manufacturing costs, shipping expenses not borne by the end user, or any other costs.\n\n\n Total product cost such that\n profit = revenue - (sum(taxes) + sum(costs))\n If product_cost is not set, then\n profit = revenue - tax - shipping - sum(CatalogItem.costs).\n\n If CatalogItem.cost is not specified for one of the items, CatalogItem.cost\nbased profit *cannot* be calculated for this Transaction. \n**Returns**\n\n- (::Google::Protobuf::Map{::String =\\\u003e ::Float}) --- Optional. All the costs associated with the product. These can be manufacturing costs, shipping expenses not borne by the end user, or any other costs.\n\n Total product cost such that\n profit = revenue - (sum(taxes) + sum(costs))\n If product_cost is not set, then\n profit = revenue - tax - shipping - sum(CatalogItem.costs).\n\n If CatalogItem.cost is not specified for one of the items, CatalogItem.cost\n based profit *cannot* be calculated for this Transaction.\n\n### #currency_code\n\n def currency_code() -\u003e ::String\n\n**Returns**\n\n- (::String) --- Required. Currency code. Use three-character ISO-4217 code. This field is not required if the event type is `refund`.\n\n### #currency_code=\n\n def currency_code=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- Required. Currency code. Use three-character ISO-4217 code. This field is not required if the event type is `refund`. \n**Returns**\n\n- (::String) --- Required. Currency code. Use three-character ISO-4217 code. This field is not required if the event type is `refund`.\n\n### #id\n\n def id() -\u003e ::String\n\n**Returns**\n\n- (::String) --- Optional. The transaction ID with a length limit of 128 bytes.\n\n### #id=\n\n def id=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- Optional. The transaction ID with a length limit of 128 bytes. \n**Returns**\n\n- (::String) --- Optional. The transaction ID with a length limit of 128 bytes.\n\n### #revenue\n\n def revenue() -\u003e ::Float\n\n**Returns**\n\n- (::Float) --- Required. Total 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. This field is not required if the event type is `refund`.\n\n### #revenue=\n\n def revenue=(value) -\u003e ::Float\n\n**Parameter**\n\n- **value** (::Float) --- Required. Total 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. This field is not required if the event type is `refund`. \n**Returns**\n\n- (::Float) --- Required. Total 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. This field is not required if the event type is `refund`.\n\n### #taxes\n\n def taxes() -\u003e ::Google::Protobuf::Map{::String =\u003e ::Float}\n\n**Returns**\n\n- (::Google::Protobuf::Map{::String =\\\u003e ::Float}) --- Optional. All the taxes associated with the transaction.\n\n### #taxes=\n\n def taxes=(value) -\u003e ::Google::Protobuf::Map{::String =\u003e ::Float}\n\n**Parameter**\n\n- **value** (::Google::Protobuf::Map{::String =\\\u003e ::Float}) --- Optional. All the taxes associated with the transaction. \n**Returns**\n\n- (::Google::Protobuf::Map{::String =\\\u003e ::Float}) --- Optional. All the taxes associated with the transaction."]]