BTNLineItem Class Reference

Inherits from BTNModelObject
Declared in BTNLineItem.h

Overview

This class represents an order’s individual line items. This is used for order attribution in [Button reportOrderWithValue:orderId:currencyCode:lineItems]. You can use these items to e.g. represent a cart of items, their ID, value and quantity or to break down the order total to vat, discount etc.

  identifier

The identifier/sku for this line item (e.g. ‘sku-1234’). Must be unique from other line items.

@property (nullable, nonatomic, copy, readonly) NSString *identifier

Discussion

The identifier/sku for this line item (e.g. ‘sku-1234’). Must be unique from other line items.

Declared In

BTNLineItem.h

  amount

Per item cost in the smallest decimal unit for this currency (e.g. 199 for $1.99).

@property (nonatomic, assign, readonly) NSInteger amount

Discussion

Per item cost in the smallest decimal unit for this currency (e.g. 199 for $1.99).

Declared In

BTNLineItem.h

  quantity

The number of items of this type.

@property (nonatomic, assign, readonly) NSInteger quantity

Discussion

The number of items of this type.

Declared In

BTNLineItem.h

  itemDescription

A name or description for this line item.

@property (nullable, nonatomic, copy, readonly) NSString *itemDescription

Discussion

A name or description for this line item.

Declared In

BTNLineItem.h

+ lineItemWithId:amount:

Creates a line item with the specified identifier and amount with a quantity of 1.

+ (nonnull instancetype)lineItemWithId:(nonnull NSString *)identifier amount:(NSInteger)amount

Parameters

identifier

The identifier/sku for this line item (e.g. ‘sku-1234’).

amount

Per item cost in the smallest decimal unit for this currency (e.g. 199 for $1.99).

Discussion

Creates a line item with the specified identifier and amount with a quantity of 1.

Declared In

BTNLineItem.h

+ lineItemWithId:amount:quantity:

Creates a line item with the specified identifier, amount, and quantity.

+ (nonnull instancetype)lineItemWithId:(nonnull NSString *)identifier amount:(NSInteger)amount quantity:(NSInteger)quantity

Parameters

identifier

The identifier/sku for this line item (e.g. ‘sku-1234’).

amount

Per item cost in the smallest decimal unit for this currency (e.g. 199 for $1.99).

quantity

The number of items of this type.

Discussion

Creates a line item with the specified identifier, amount, and quantity.

Declared In

BTNLineItem.h

+ lineItemWithId:amount:quantity:description:

Creates a line item with the specified identifier, amount, quantity, and description. Examples: @code // 3 bottles of wine at 15.99 each BTNLineItem *lineItem = [BTNLineItem lineItemWithId:@“abc123” amount:1599 quantity:3 description:@“Las Rocas”];

+ (nonnull instancetype)lineItemWithId:(nonnull NSString *)identifier amount:(NSInteger)amount quantity:(NSInteger)quantity description:(nullable NSString *)description

Parameters

identifier

The identifier/sku for this line item (e.g. ‘sku-1234’).

amount

Per item cost in the smallest decimal unit for this currency (e.g. 199 for $1.99).

quantity

The number of items of this type.

description

A name or description for this item (optional).

Discussion

Creates a line item with the specified identifier, amount, quantity, and description. Examples: @code // 3 bottles of wine at 15.99 each BTNLineItem *lineItem = [BTNLineItem lineItemWithId:@“abc123” amount:1599 quantity:3 description:@“Las Rocas”];

@endcode

Declared In

BTNLineItem.h

– addAttribute:forKey:

Each line item can have optional free form attributes associated with them.

- (void)addAttribute:(nonnull NSString *)attribute forKey:(nonnull NSString *)key

Parameters

attribute

The attribute value.

key

The key representing the attribute.

Discussion

Each line item can have optional free form attributes associated with them.

Declared In

BTNLineItem.h

– attributes

The attributes associated with this line item.

- (nullable NSDictionary *)attributes

Return Value

an NSDictionary of attributes.

Discussion

The attributes associated with this line item.

Declared In

BTNLineItem.h