Try our conversational search powered by Generative AI!

How to add Cart Payment to Purchase Order Payment Option


Hi all,

please help me to get on from this. I have requirement to add Payment from cart to Purchase order. 

For this I tried as below

 var purchaseOrder = _orderRepository.Load(orderRef);

 var cartPayment = cart.GetFirstForm().Payments.FirstOrDefault();

 var POPayment = purchaseOrder.GetFirstForm().Payments.FirstOrDefault();

  1. purchaseOrder.GetFirstForm().Payments.Add(cartPayment);
  2. purchaseOrder.AddPayment((IOrderForm)purchaseOrder.GetFirstForm(), (IPayment)cartPayment);

In both case its getting exception as " Value cannot be null".  

Help me to achieve the same.

Thank You!!

Feb 19, 2020 13:26

If you debug your code, which code is throwing that exception?

Feb 19, 2020 14:08

In both 1 and 2 cases are throwing an exception as I mentioned

Feb 20, 2020 8:05

No, I don't mean which option, but which exactly line is throw exception and with what stacktrace? 

Feb 20, 2020 8:06
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.