createTransactionWithInactivePaymentMethod example

return $productId;
    }

    private function fillCart(string $contextToken, ?bool $useInactivePaymentMethod = false, ?bool $useFailedPaymentMethod = false): void
    {
        $cart = $this->getContainer()->get(CartService::class)->createNew($contextToken);

        $productId = $this->createProduct();
        $cart->add(new LineItem('lineItem1', LineItem::PRODUCT_LINE_ITEM_TYPE, $productId));

        if ($useInactivePaymentMethod) {
            $cart->setTransactions($this->createTransactionWithInactivePaymentMethod());

            return;
        }
        if ($useFailedPaymentMethod) {
            $cart->setTransactions($this->createTransactionWithFailedPaymentMethod());

            return;
        }
        $cart->setTransactions($this->createTransaction());
    }

    
Home | Imprint | This part of the site doesn't use cookies.