1

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->setName($item->getName());
        $basketItem->setCategory1("Category1");
        $basketItem->setCategory2("Category2");
        $basketItem->setItemType(\Iyzipay\Model\BasketItemType::PHYSICAL);
        $basketItem->setPrice('' . ($item->getPrice() * $item->getQuantity()));

        array_push($basketItems, $basketItem);
    }

    $request->setBasketItems($basketItems);

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->setLocale(\Iyzipay\Model\Locale::TR);
    $request->setPaymentGroup(\Iyzipay\Model\PaymentGroup::PRODUCT);
    $request->setCurrency('TRY');
    $request->setConversationId('' . $this->getTransactionId());
    $request->setPrice($amount);
    $request->setPaidPrice($amount);
    $request->setCallbackUrl($this->getReturnUrl());

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

Browse other questions tagged or ask your own question.