Order events
Overview
Order events represent the key events once the customer finishes the checkout process, completes the purchase, and the order confirmation page loads. Affirm’s machine learning systems draw upon this transaction data to improve our marketing products off- and onsite, providing more relevant, better converting financial offers to your customers over time.
trackOrderConfirmed (Order, Optional[Strict])
An event triggered when a customer completes the purchase. You can measure the sale of one or more products by this event.
Parameters
Parameters | Data type | Description |
---|---|---|
| object | The confirmed order. |
| boolean | True/False flag for ensuring the |
Example
affirm.analytics.trackOrderConfirmed({
"currency": "USD",
"orderId": "AA-87654",
"paymentMethod": "Affirm",
"total": 23595
}, null, true);
An event triggered when a user cancels an order.
Parameters
Parameter | Data type | Description |
---|---|---|
| object | The canceled order. |
'product` | array | Products that were canceled by this order. |
| boolean | True/False flag for ensuring the |
Example
affirm.analytics.trackOrderCancelled({
"storeName": "Affirm Store",
"coupon": "SUMMER2018",
"currency": "USD",
"discount": 0,
"paymentMethod": "Visa",
"revenue": 2920,
"shipping": 534,
"shippingMethod": "Fedex",
"tax": 285,
"orderId": "T12345",
"total": 3739
}, [{
"brand": "Affirm",
"category": "Apparel",
"coupon": "SUMMER2018",
"name": "Affirm T-Shirt",
"price": 730,
"productId": "SKU-1234",
"quantity": 1,
"variant": "Black"
}, {
"brand": "Affirm",
"category": "Apparel",
"coupon": "SUMMER2018",
"name": "Affirm Turtleneck Sweater",
"price": 2190,
"productId": "SKU-5678",
"quantity": 1,
"variant": "Black"
}]);
trackOrderRefunded (String, String, Integer, Optional[Product])
An event triggered when an order is partially or fully refunded.
Parameters
Parameter | Data type | Description |
---|---|---|
| string | A unique identifier representing the transaction to fully or partially refund. |
| integer | The amount to refund, either partially or fully. |
| string | Three-letter ISO currency code, in uppercase. Possible values:
|
'product` | array | An array of objects representing the products within the order correlated to the refund amount. |
Example
affirm.analytics.trackOrderRefunded(
"O12345", 3739, "USD",
[{
"brand": "Affirm",
"category": "Apparel",
"coupon": "SUMMER2018",
"name": "Affirm T-Shirt",
"price": 730,
"productId": "SKU-1234",
"quantity": 1,
"variant": "Black"
}, {
"brand": "Affirm",
"category": "Apparel",
"coupon": "SUMMER2018",
"name": "Affirm Turtleneck Sweater",
"price": 2190,
"productId": "SKU-5678",
"quantity": 1,
"variant": "Black"
}]
);
An event triggered when a user updates an order.
Parameters
Parameter | Data type | Description |
---|---|---|
| object | The updated order. |
'product` | array | Products that were updated by this order. |
| boolean | True/False flag for ensuring the |
Example
affirm.analytics.trackOrderUpdated({
"storeName": "Affirm Store",
"coupon": "SUMMER2018",
"currency": "USD",
"discount": 0,
"paymentMethod": "Visa",
"revenue": 2920,
"shipping": 534,
"shippingMethod": "Fedex",
"tax": 285,
"orderId": "T12345",
"total": 3739
}, [{
"brand": "Affirm",
"category": "Apparel",
"coupon": "SUMMER2018",
"name": "Affirm T-Shirt",
"price": 730,
"productId": "SKU-1234",
"quantity": 1,
"variant": "Black"
}, {
"brand": "Affirm",
"category": "Apparel",
"coupon": "SUMMER2018",
"name": "Affirm Turtleneck Sweater",
"price": 2190,
"productId": "SKU-5678",
"quantity": 1,
"variant": "Black"
}]);
Objects
Order
Represents a single customer's checkout transaction. This includes parameters related to the transaction once the customer completes their checkout.
Parameter | Description | |
---|---|---|
| string | Unique identifier of order in your system |
| string | Three-letter ISO currency code, in uppercase. Possible values:
|
| string | Description of payment method used (ex. “Visa”, “Mastercard”, “Gift Card”) |
| integer | The total value of the transaction, including tax and shipping. If not sent, this value will be automatically calculated using the product quantity and price fields of all products in the same hit. The value must be non-negative and represented as cents instead of dollars. |
Product
Represents any offered product or service.
Parameter | Description | |
---|---|---|
brand | string | The brand of the product (e.g., Affirm). |
category | string | The category the product belongs to (e.g. Apparel). |
coupon | string | Any coupon code associated with the particular instance of this product. |
name | string | The full name of the product (e.g., Affirm T-Shirt). |
price | integer | The price of the product. The value must be non-negative and represented as cents instead of dollars. |
productID | string | A unique identifier representing the product, such as the SKU or an internal database identifier used by the merchant. |
quantity | integer | The quantity of the product. The value must be non-negative. |
variant | string | The variant of the product (e.g. black). |
currency | string | A currency code associated with this product (USD) |
Updated about 1 year ago