/rest/default/V1/carts/mine/payment-information
-
17-12-2020 - |
Question
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.
Solution
/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;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange