Item

See https://developer.paypal.com/docs/api/orders/v2/#definition-item.

Methods

Item::__construct()

Creates an item object using constructor.

Signature

public function __construct(string $name, AmountContract $amount, int $quantity = 1);

Example

$amount = Amount::of('100', 'USD');
$item = new Item('Item name', $amount, 2);

Item::create()

A static helper method to create a new item.

Signature

public static function create(string $name, string $value, string $currency_code = 'USD', int $quantity = 1): Item;

Example

Item::setUnitAmount()

A method to override a unit amount on an item.

Signature

Example

Item::getSku()

Returns a sku value assigned to an Item, default to uniqid().

Signature

Example

Item::setSku()

Sets an sku value on an item.

Signature

Example

Item::getName()

Returns an item name.

Signature

Example

Item::setName()

Sets an item name.

Signature

Example

Item::getDescription()

Returns an item description. defaults to null

Signature

Example

Item::setDescription()

Sets an item description.

Signature

Example

Item::getQuantity()

Returns an item quantity. defaults to 1

Signature

Example

Item::setQuantity()

Sets an item quantity.

Signature

Example

Item::getCategory()

Returns an item quantity. defaults to DIGITAL_GOODS

Signature

Example

Item::setCategory()

Sets an item category.

Signature

Available category options

Example

Item::toArray()

Returns an item array representation. used when serializing an item into http request.

Signature

Example

Last updated

Was this helpful?