SCPCartLineItem

Objective-C


@interface SCPCartLineItem : NSObject

Swift

class CartLineItem : NSObject

Represents a single line item in an SCPCart, displayed on the reader’s screen during checkout.

  • The quantity of the line item being purchased.

    Declaration

    Objective-C

    @property (nonatomic) NSInteger quantity;

    Swift

    var quantity: Int { get set }
  • The description or name of the item.

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *_Nonnull displayName;

    Swift

    var displayName: String { get set }
  • The price of the item, provided in the cart’s currency’s smallest unit.

    Declaration

    Objective-C

    @property (nonatomic) NSInteger amount;

    Swift

    var amount: Int { get set }
  • The values set here will be shown on the screen as-is. Make sure you’re correctly calculating and setting the SCPCart’s tax and total – the reader will not calculate tax or total for you. Similarly, make sure the values displayed reflect what the customer is actually charged.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithDisplayName:(nonnull NSString *)displayName
                                       quantity:(NSInteger)quantity
                                         amount:(NSInteger)amount;

    Swift

    init(displayName: String, quantity: Int, amount: Int)

    Parameters

    displayName

    The description or name of the item.

    quantity

    The quanitity of the item that should show in the cart.

    amount

    The price in the currency’s smallest unit. The line item will assume the currency of the parent SCPCart.