/** * Creates and returns the payment component of a PayPal Digital Goods NVP API request. * * PayPal requires the category component for all items in a digital goods purchase to be set as Digital. * This function specifies that all goods are digital, then calls @see parent::add_payment() to create * the rest of the API request (which is the same as a vanilla Express Checkout request). * * @uses parent::add_payment() to create non digital goods components of the request. * @return Array An array of name value pairs for each element representing a payment in a PayPal Digital Goods NVP API request. */ protected function add_payment($action) { $request = parent::add_payment($action); // Make sure PayPal knows all goods are digital for ($i = 0; $i < count($this->options['items']); $i++) { $request += array("L_PAYMENTREQUEST_0_ITEMCATEGORY{$i}" => 'Digital'); } return $request; }