When i applied discounts, my payment gateway gives an error. It says that Basket items price must be greater than zero. Here is the section that takes items in cart:

// Add items
    $basketItems = [ ];
    $items       = $this->getItems();

    foreach ($items as $item) {
        $basketItem = new \Iyzipay\Model\BasketItem();
        $basketItem->setId("item:" . $item->getName());
        $basketItem->setPrice('' . ($item->getPrice() * $item->getQuantity()));

        array_push($basketItems, $basketItem);


Without discounts plugin works fine. I can get payments.

One additional thing is; that payment gateway accepts two basket amount as price and paidPrice which is total amount of basket and final amount(tax+discount+sale...) respectively. But when i look at my plugin this amount is set as same:

public function getData ()
    $card = $this->getCard();

    $amount = '' . $this->getAmount();

    $email     = $card->getEmail();
    $firstName = $card->getFirstName();
    $lastName  = $card->getLastName();
    $fullName  = $firstName . ' ' . $lastName;

    $billingAddress = $card->getBillingAddress1() . ' ' . $card->getBillingAddress2();
    $billingCity    = $card->getBillingCity();
    $billingCountry = $card->getBillingCountry();

    $shippingAddress = $card->getShippingAddress1() . ' ' . $card->getShippingAddress2();
    $shippingCity    = $card->getShippingCity();
    $shippingCountry = $card->getShippingCountry();

    $request = new \Iyzipay\Request\CreateCheckoutFormInitializeRequest();
    $request->setConversationId('' . $this->getTransactionId());

Shouldn't be the price and paidPrice be different? May be these two are not related but i want to mention.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy