# Google Cloud Recommendation Engine V1beta1 Client - Class PurchaseTransaction (0.9.3)

0.9.3 (latest) 0.9.2 0.8.2 0.7.7 0.6.4 0.5.0 0.4.12

> [!WARNING]
> **Beta**
>
>
> This library is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1)
> of the Terms of Service. Pre-GA libraries might have limited support,
> and changes to pre-GA libraries might not be compatible with other pre-GA versions.
> For more information, see the
> [launch stage descriptions](https://docs.cloud.google.com/products#product-launch-stages).

Reference documentation and code samples for the Google Cloud Recommendation Engine V1beta1 Client class PurchaseTransaction.

A transaction represents the entire purchase transaction.

Generated from protobuf message `google.cloud.recommendationengine.v1beta1.PurchaseTransaction`

## Namespace

Google \\ Cloud \\ RecommendationEngine \\ V1beta1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ id` | `string` Optional. The transaction ID with a length limit of 128 bytes. |
| `↳ revenue` | `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`. |
| `↳ taxes` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Optional. All the taxes associated with the transaction. |
| `↳ costs` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` 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` | `string` Required. Currency code. Use three-character ISO-4217 code. This field is not required if the event type is `refund`. |

### getId

Optional. The transaction ID with a length limit of 128 bytes.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setId

Optional. The transaction ID with a length limit of 128 bytes.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRevenue

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** ||
|---|---|
| **Type** | **Description** |
| `float` |   |

### setRevenue

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`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `float` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTaxes

Optional. All the taxes associated with the transaction.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |   |

### setTaxes

Optional. All the taxes associated with the transaction.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCosts

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** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |   |

### setCosts

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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCurrencyCode

Required. Currency code. Use three-character ISO-4217 code. This field
is not required if the event type is `refund`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setCurrencyCode

Required. Currency code. Use three-character ISO-4217 code. This field
is not required if the event type is `refund`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |