SCPCart

Objective-C

@interface SCPCart : NSObject

Swift

class SCPCart : NSObject

SCPCart contains information about what should display on the reader’s cart. It should be created and then passed into setReaderDisplay, which will place the contents of the cart on the reader’s display.

You can pass the same SCPCart to multiple calls of setReaderDisplay since the cart is not coupled to any specific call of setReaderDisplay.

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 the Verifone P400 supports 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 }
  • tax

    The amount of tax in cents.

    Declaration

    Objective-C

    @property (nonatomic) NSInteger tax;

    Swift

    var tax: Int { get set }
  • Total balance of cart due in cents.

    Declaration

    Objective-C

    @property (nonatomic) NSInteger total;

    Swift

    var total: Int { get set }
  • The currency of the basket (i.e. USD or AUD).

    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.

    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;