public class

LineItem

extends Object
java.lang.Object
   ↳ com.usebutton.sdk.LineItem

Class Overview

Class representing an order's individual line items. This is used for order attribution in reportOrder(List, String, String). You can use these items to e.g. represent an cart of items, their ID, value and quantity or to break down the order total to vat, discount etc.

Summary

Public Constructors
LineItem(String identifier, int amount)
LineItem(String identifier, int amount, int quantity)
LineItem(String identifier, int amount, int quantity, String description)
Examples:
     // 3 carrots at $1.99 (ea)
     LineItem carrots = new LineItem("carrot", 199, 3, "Fresh Carrots");
     // 1 banana at $3.99 (ea)
     LineItem banana = new LineItem("banana", 399, 1, "Left Banana");
 
Public Methods
JSONObject getData()
LineItem setAttribute(String name, String value)
Each line item can have optional free form attributes on them that will be used in the processing of these items.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public LineItem (String identifier, int amount)

Parameters
identifier your items identifier or identifier for this line item ("sku-1234")
amount the per item cost in the smallest decimal unit for this currency, see reportOrder(List, String, String) for more information about currency. (199 for $1.99)

public LineItem (String identifier, int amount, int quantity)

Parameters
identifier your items identifier or identifier for this line item ("sku-1234")
amount the per item cost in the smallest decimal unit for this currency, see reportOrder(int, String, String) for more information about currency. (199 for $1.99)
quantity the number of items of this type (1)

public LineItem (String identifier, int amount, int quantity, String description)

Examples:

     // 3 carrots at $1.99 (ea)
     LineItem carrots = new LineItem("carrot", 199, 3, "Fresh Carrots");
     // 1 banana at $3.99 (ea)
     LineItem banana = new LineItem("banana", 399, 1, "Left Banana");
 

Parameters
identifier /sku your items identifier or identifier for this line item ("sku-1234")
amount the per item cost in the smallest decimal unit for this currency, see reportOrder(int, String, String) for more information about currency. (199 for $1.99)
quantity the number of items of this type (3)
description /name a longer description for this item ("Moose Felt Print")

Public Methods

public JSONObject getData ()

public LineItem setAttribute (String name, String value)

Each line item can have optional free form attributes on them that will be used in the processing of these items.

Returns
  • same object, for convenience