0

Im using Braintree credit card in sandbox mode.

it seems to be failing at the line:

$orderId = $this->cartManagement->placeOrder($cartId);

Any ideas why this would be, should I be using HTTPS on my localhost ?

here is the full function:

```

public function savePaymentInformationAndPlaceOrder(
    $cartId,
    $email,
    \Magento\Quote\Api\Data\PaymentInterface $paymentMethod,
    \Magento\Quote\Api\Data\AddressInterface $billingAddress = null
) {

    $salesConnection = $this->connectionPull->getConnection('sales');
    $checkoutConnection = $this->connectionPull->getConnection('checkout');
    $salesConnection->beginTransaction();
    $checkoutConnection->beginTransaction();

    try {
        $this->savePaymentInformation($cartId, $email, $paymentMethod, $billingAddress);

        try {

            $orderId = $this->cartManagement->placeOrder($cartId);

        } catch (\Magento\Framework\Exception\LocalizedException $e) {

            throw new CouldNotSaveException(
                __($e->getMessage()),
                $e
            );

        } catch (\Exception $e) {
            $this->getLogger()->critical($e);
            throw new CouldNotSaveException(
                __('An error occurred on the server. Please try to place the order again.'),
                $e
            );
        }
        $salesConnection->commit();
        $checkoutConnection->commit();
    } catch (\Exception $e) {
        $salesConnection->rollBack();
        $checkoutConnection->rollBack();
        throw $e;
    }

    return $orderId;
}

```

Why can It not place the order ?

Thanks.

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.