SCPCart
Objective-C
@interface SCPCart : NSObject
Swift
class Cart : NSObject
An SCPCart
object contains information about what line items are included in
the current transaction. A cart object should be created and then passed into
Terminal.shared.setReaderDisplay()
, which will display the cart’s contents
on the reader’s screen.
The SCPCart
only represents exactly what will be shown on the screen, and is
not reflective of what the customer is actually charged. You are
responsible for making sure that tax and total reflect what is in the cart.
Note
Only Internet readers support setReaderDisplay functionality
-
You can add or remove line items from this array individually or reassign the array entirely. After making your desired changes, call setReaderDisplay to update the cart on the reader’s screen.
Declaration
Objective-C
@property (nonatomic, strong) NSMutableArray<SCPCartLineItem *> *_Nonnull lineItems;
Swift
var lineItems: NSMutableArray { get set }
-
The displayed tax amount, provided in the currency’s smallest unit.
Declaration
Objective-C
@property (nonatomic) NSInteger tax;
Swift
var tax: Int { get set }
-
The cart’s total balance, provided in the currency’s smallest unit.
Declaration
Objective-C
@property (nonatomic) NSInteger total;
Swift
var total: Int { get set }
-
The currency of the cart.
Declaration
Objective-C
@property (nonatomic, copy) NSString *_Nonnull currency;
Swift
var currency: String { get set }
-
Initializes an SCPCart with tax and total, in cents, as well as the currency. These values are exactly what will be shown on the screen and do not reflect what the user is actually charged.
This initializer will initialize
lineItems
as an empty array.Declaration
Objective-C
- (nonnull instancetype)initWithCurrency:(nonnull NSString *)currency tax:(NSInteger)tax total:(NSInteger)total;
Swift
init(currency: String, tax: Int, total: Int)
Parameters
tax
The tax in cents
total
The total in cents
currency
The currency of the basket (i.e. USD or AUD)
-
Unavailable
Use initWithTax:
Declaration
Objective-C
- (nonnull instancetype)init;
-
Unavailable
Use initWithTax:
Declaration
Objective-C
+ (nonnull instancetype)new;