/** * Set the inventory level and inventory management features for the specified button. * When you set the inventory level for a button, PayPal can track inventory, * calculate the gross profit associated with sales, send you an alert * when inventory drops below a specified quantity, and manage sold out conditions. * * Required NVPs: * TRACKINV ::= 0 | 1 * TRACKPNL ::= 0 | 1 * ..Plus some additional information depending on your choice, see PayPal's documentation.. * * Response NVP: TRANSACTIONID * * @param string $name Button name (used locally to track buttons) * @param array $nvp Name-value-pairs (assoc array) * @return mixed $nvp Name-value-pairs (assoc array) on success, false on failure */ public function setInventory($name, $nvp) { if (empty($name) || !($button = $this->getButton($name))) { return false; } $nvp['METHOD'] = 'BMSetInventory'; $nvp['HOSTEDBUTTONID'] = $button->hostedButtonId; $result = PPUtils::nvpRequest($nvp); if ($result) { self::log("Successfully performed setInventory call", "info", $nvp, $result); } else { self::log("Failed to perform setInventory call", "error", $nvp); } return $result; }