3

Can anyone explain what does /rest/default/V1/carts/mine/payment-information it mean?

I want to hide Cash payment option. By using jquery I am able to hide cash payment option but when page get refreshed through order summary page, then Cash payment option get displayed.

5

/rest/default/V1/carts/mine/payment-information Is the rest api which map to PaymentInformationManagementInterface. Here mine means you are logged in customer.

Open vendor/magento/module-checkout/etc/webapi.xml here actually map.

When you click Place Order button, magento call vendor/magento/module-checkout/Model/PaymentInformationManagement.php

savePaymentInformationAndPlaceOrder


/**
 * {@inheritDoc}
 */
public function savePaymentInformationAndPlaceOrder(
    $cartId,
    \Magento\Quote\Api\Data\PaymentInterface $paymentMethod,
    \Magento\Quote\Api\Data\AddressInterface $billingAddress = null
) {
    $this->savePaymentInformation($cartId, $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
        );
    }
    return $orderId;
}
  • thanks for the valuable information. Can u tell me, Is it possible to hide Cash payment option on onclick of Check payment option? – jassi Nov 19 '17 at 5:23
  • Yes, you need to do with js stuff – Sohel Rana Nov 19 '17 at 5:25
  • using jquery I am able to hide cash payment option but when page get refreshed through order summary page, then Cash payment option get displayed – jassi Nov 19 '17 at 5:27
  • 1
    as a complement alanstorm.com/magento-2-checkout-application-order-placing – medmek Jul 17 '18 at 14:36
  • What is the solution ? I am getting the same error. – David Coder Sep 21 '18 at 11:50

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.