public sealed class PurchaseTransaction : IMessage<PurchaseTransaction>, IEquatable<PurchaseTransaction>, IDeepCloneable<PurchaseTransaction>, IBufferMessage, IMessage
Reference documentation and code samples for the Recommendations AI v1beta1 API class PurchaseTransaction.
A transaction represents the entire purchase transaction.
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.
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"]],[["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 2025-08-07 UTC."],[[["\u003cp\u003eThe \u003ccode\u003ePurchaseTransaction\u003c/code\u003e class in the Recommendations AI v1beta1 API represents an entire purchase transaction and implements several interfaces for message handling, equality checks, and cloning.\u003c/p\u003e\n"],["\u003cp\u003eThe class includes properties such as \u003ccode\u003eCosts\u003c/code\u003e, \u003ccode\u003eCurrencyCode\u003c/code\u003e, \u003ccode\u003eId\u003c/code\u003e, \u003ccode\u003eRevenue\u003c/code\u003e, and \u003ccode\u003eTaxes\u003c/code\u003e, which are used to store detailed financial data related to the transaction.\u003c/p\u003e\n"],["\u003cp\u003eIt is found in the \u003ccode\u003eGoogle.Cloud.RecommendationEngine.V1Beta1\u003c/code\u003e namespace, within the \u003ccode\u003eGoogle.Cloud.RecommendationEngine.V1Beta1.dll\u003c/code\u003e assembly, and inherits from the base \u003ccode\u003eobject\u003c/code\u003e class.\u003c/p\u003e\n"],["\u003cp\u003eThe class offers two constructors for creating instances: a default constructor and one that accepts another \u003ccode\u003ePurchaseTransaction\u003c/code\u003e object as a parameter for copying.\u003c/p\u003e\n"],["\u003cp\u003eThere are three available versions for the \u003ccode\u003ePurchaseTransaction\u003c/code\u003e class, with the latest being \u003ccode\u003e2.0.0-beta06\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Recommendations AI v1beta1 API - Class PurchaseTransaction (2.0.0-beta06)\n\nVersion latestkeyboard_arrow_down\n\n- [2.0.0-beta06 (latest)](/dotnet/docs/reference/Google.Cloud.RecommendationEngine.V1Beta1/latest/Google.Cloud.RecommendationEngine.V1Beta1.PurchaseTransaction)\n- [2.0.0-beta05](/dotnet/docs/reference/Google.Cloud.RecommendationEngine.V1Beta1/2.0.0-beta05/Google.Cloud.RecommendationEngine.V1Beta1.PurchaseTransaction)\n- [1.0.0-beta03](/dotnet/docs/reference/Google.Cloud.RecommendationEngine.V1Beta1/1.0.0-beta03/Google.Cloud.RecommendationEngine.V1Beta1.PurchaseTransaction) \n\n public sealed class PurchaseTransaction : IMessage\u003cPurchaseTransaction\u003e, IEquatable\u003cPurchaseTransaction\u003e, IDeepCloneable\u003cPurchaseTransaction\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Recommendations AI v1beta1 API class PurchaseTransaction.\n\nA transaction represents the entire purchase transaction. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e PurchaseTransaction \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[PurchaseTransaction](/dotnet/docs/reference/Google.Cloud.RecommendationEngine.V1Beta1/latest/Google.Cloud.RecommendationEngine.V1Beta1.PurchaseTransaction), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[PurchaseTransaction](/dotnet/docs/reference/Google.Cloud.RecommendationEngine.V1Beta1/latest/Google.Cloud.RecommendationEngine.V1Beta1.PurchaseTransaction), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[PurchaseTransaction](/dotnet/docs/reference/Google.Cloud.RecommendationEngine.V1Beta1/latest/Google.Cloud.RecommendationEngine.V1Beta1.PurchaseTransaction), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.RecommendationEngine.V1Beta1](/dotnet/docs/reference/Google.Cloud.RecommendationEngine.V1Beta1/latest/Google.Cloud.RecommendationEngine.V1Beta1)\n\nAssembly\n--------\n\nGoogle.Cloud.RecommendationEngine.V1Beta1.dll\n\nConstructors\n------------\n\n### PurchaseTransaction()\n\n public PurchaseTransaction()\n\n### PurchaseTransaction(PurchaseTransaction)\n\n public PurchaseTransaction(PurchaseTransaction other)\n\nProperties\n----------\n\n### Costs\n\n public MapField\u003cstring, float\u003e Costs { get; }\n\nOptional. All the costs associated with the product. These can be\nmanufacturing costs, shipping expenses not borne by the end user, or any\nother costs.\n\nTotal product cost such that\nprofit = revenue - (sum(taxes) + sum(costs))\nIf product_cost is not set, then\nprofit = revenue - tax - shipping - sum(CatalogItem.costs).\n\nIf CatalogItem.cost is not specified for one of the items, CatalogItem.cost\nbased profit *cannot* be calculated for this Transaction.\n\n### CurrencyCode\n\n public string CurrencyCode { get; set; }\n\nRequired. Currency code. Use three-character ISO-4217 code. This field\nis not required if the event type is `refund`.\n\n### Id\n\n public string Id { get; set; }\n\nOptional. The transaction ID with a length limit of 128 bytes.\n\n### Revenue\n\n public float Revenue { get; set; }\n\nRequired. Total revenue or grand total associated with the transaction.\nThis value include shipping, tax, or other adjustments to total revenue\nthat you want to include as part of your revenue calculations. This field\nis not required if the event type is `refund`.\n\n### Taxes\n\n public MapField\u003cstring, float\u003e Taxes { get; }\n\nOptional. All the taxes associated with the transaction."]]