I have created a custom payment plugin, at this point I need to retrieve shopper mobile number for payment processing method. How do i get the mobile number from the form at checkout? Any help? Thanks.
Thanks for the response. Yes, I have created the form with the textbox for the client to input mobile number. I want to be able to parse the mobile number into the ProcessPayment in the IPaymentMethod, also the orderId not the orderGuid.
The data structure that is passed into ProcessPayment is ProcessPaymentRequest There is field called CustomValues which could probably be used to carry the Phone number through to ProcessPayment
RE: orderId - When ProcessPayment routine is called then the order has not been created yet so there is no Order Number PostProcessPayment routine is called after the order is created
I've been able to retrieve the form values through the GetPaymentInfo method but I need those values in the ProcessPayment method, I'm unable to pull the form values there. Do I have to create session variables?
Yes you can use session variables Look at Presentation\Nop.Web\Controllers\CheckoutController.cs which Sets HttpContext.Session.Set<ProcessPaymentRequest>("OrderPaymentInfo", processPaymentRequest); and Gets var processPaymentRequest = HttpContext.Session.Get<ProcessPaymentRequest>("OrderPaymentInfo"); the OrderPaymentInfo
The data structure that is passed into ProcessPayment is ProcessPaymentRequest There is field called CustomValues which could probably be used to carry the Phone number through to ProcessPayment
RE: orderId - When ProcessPayment routine is called then the order has not been created yet so there is no Order Number PostProcessPayment routine is called after the order is created
Perhaps I wasn't very clear with my question. Here is my code below
public ProcessPaymentResult ProcessPayment(ProcessPaymentRequest processPaymentRequest) { var result = new ProcessPaymentResult();
var NewpaymentInfo = new ProcessPaymentRequest(); Dictionary<string, object> customValues = new Dictionary<string, object>(); NewpaymentInfo.CustomValues.Add("MobileNumber",form["MobileNumber"]);
return result; }
Hopefully with this you can point me in the right direction. I want to insert the mobile number from the form to be used in this ProcessPayment method.
RE: "....insert the mobile number from the form to be used in this ProcessPayment method."
You have it backwards. As per my above, '.... GetPaymentInfo method can put values in the "field called CustomValues" ...'. Then, in ProcessPayment you would reference the CustomValues.
(Also, I don't think you need to "new" the Dictionary. An instance should already exist; just add the key/value)
I have instantiated and supplied the values into the custom values in the GetPaymentInfo. Pardon me but how do i reference them in the ProcessPayment method? (I'm new to MVC :( ) I have failed a number of times to achieve this, even attempted session variables.
Kindly refer my previous post, see where I'm getting it wrong
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.