Transactions
The addTransaction
function keeps a record of the transaction when a user purchases
anything from your site. The reason to use this in combination with purchased
is to enable more
comprehensive transaction analytics. This function allows you to track the individual items purchased,
how much the total purchase was, item descriptions, etc.
addTransaction() function
Adds a transaction to the analytics database. Includes product and price data.
Signature:export declare function addTransaction(orderId: string,transaction: TransactionInput): Promise<void>;
Parameters
Parameter | Type | Description |
---|---|---|
orderId | string | The id of the order |
transaction | TransactionInput | The transaction with the respective products |
Promise<void>
TransactionInput interface
Properties
Property | Type | Description |
---|---|---|
meta? | object | (Optional) Additional properties assocaited to the transaction |
order_id? | string | (Optional) The id of the order in your system, used for matching orders between your system and Pumpjack's |
products | Product[] | The list of items contained in this order |
subtotal? | number | (Optional) The total cost before tax |
tax | number | Total amount of tax |
total | number | Transaction total cost w/ tax included |
type | "ticket" | "merchandise" | "food_and_bev" | "ott_subscription" | "multi" | The type of the transaction |
user_id? | string | (Optional) The id of the user associated with this transaction. |
transacted_at? | Date | (Optional) |
Product interface
Properties
Property | Type | Description |
---|---|---|
currency_code? | string | (Optional) The currency code for the cost of the product. Uses ISO 4217 alpha codes |
description? | string | (Optional) The description of the product |
id? | string | (Optional) |
meta? | object | (Optional) Any additional data to store in association to this product. |
name | string | The name of the product |
type | string | The type of the product |
price | number | The price of a single one of this item w/o tax etc. |
quantity | number | Describes how many of this item are in the purchase |
sku? | string | (Optional) The sku or product id |
tax? | number | (Optional) How much tax is placed on this order for these items |
total? | number | (Optional) The total cost associated with this item, including all quantity and tax. |
vendor? | string | (Optional) The name of the vendor for the product |