PayPal\Api\ItemList::getItems PHP Méthode

getItems() public méthode

List of items.
public getItems ( ) : Item[]
Résultat Item[]
    public function getItems()
    {
        return $this->items;
    }

Usage Example

 /**
  * Create the Payment request and process
  * @return null|string The approval url to which the user has to be redirected
  */
 public function createPayment()
 {
     $payer = new Payer();
     $payer->setPaymentMethod("paypal");
     $this->validateData();
     if (!is_null($this->details)) {
         $this->getAmount()->setDetails($this->details);
     }
     $transaction = new Transaction();
     $transaction->setAmount($this->getAmount())->setDescription($this->getDescription())->setInvoiceNumber($this->getInvoiceNumber());
     if (count($this->itemList->getItems())) {
         $transaction->setItemList($this->itemList);
     }
     $redirectUrls = new RedirectUrls();
     $redirectUrls->setReturnUrl($this->getSuccessUrl(self::paymentMethod))->setCancelUrl($this->getCancelUrl(self::paymentMethod));
     $payment = new Payment();
     $payment->setIntent(self::ACTION)->setPayer($payer)->setRedirectUrls($redirectUrls)->setTransactions(array($transaction));
     try {
         $payment->create($this->getApiContext($this->clientId, $this->clientSecret));
     } catch (\Exception $ex) {
         $this->container->get('logger')->error($ex);
         return null;
     }
     $approvalUrl = $payment->getApprovalLink();
     return $approvalUrl;
 }
All Usage Examples Of PayPal\Api\ItemList::getItems