Try our conversational search powered by Generative AI!

Specified payment method " {payment.PaymentMethodId)}" has not been defined.


Hi All,

We are seen strange error when try to get 'Payment Methods' from the episever CMS site for some users. Please see error details as follow,


Server Error in '/' Application.
Specified payment method "{payment.PaymentMethodId)}" has not been defined.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.MissingMethodException: Specified payment method "{payment.PaymentMethodId)}" has not been defined.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[MissingMethodException: Specified payment method "{payment.PaymentMethodId)}" has not been defined.]
EPiServer.Commerce.Order.DefaultPaymentProcessor.CreatePaymentGatewayProvider(IPayment payment) +760
EPiServer.Commerce.Order.DefaultPaymentProcessor.ProcessPayment(IOrderGroup orderGroup, IPayment payment, IShipment shipment) +151
System.Linq.WhereSelectListIterator`2.MoveNext() +117
System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection) +526
EPiServer.Commerce.Order.IOrderGroupExtensions.ProcessPayments(IOrderGroup orderGroup, IPaymentProcessor paymentProcessor, IOrderGroupCalculator orderGroupCalculator) +558
GreenCrossHealth.EpiServer.Services.Commerce.CartService.ProcessPayment(ICart currentCart, PaymentDetailsForm paymentDetailsForm) in E:\build-dir\11665409\GXH-BFD-BC\Source\GreenCrossHealth.EpiServer.Services\Commerce\CartService.cs:657

We are using EpiServer Ver 11.

Could you please help me to resolve this issue?


Dec 09, 2018 22:43

The payment method that you are using was not added to the system (via Commerce Manager). You probably want to check that 

Dec 10, 2018 7:48

Hi Quan
Thanks for the response. yes, that is correct, we add the payment method on site start up if it does not exist as follows,

var paymarkPaymentMethodDto = PaymentManager.GetPaymentMethodBySystemName("OurPaymentMethodname", SiteContext.Current.LanguageName);

if(paymarkPaymentMethodDto.PaymentMethod.Count == 0)
var newPaymentMethodRow = paymarkPaymentMethodDto.PaymentMethod.NewPaymentMethodRow();
//....Add and Set new payment method details here...

PaymentMethod paymarkPaymentMethod = new PaymentMethod(newPaymentMethodRow);

How do we safely correct? Do we remove the above code, delete the method from the CMS and then recreate it manually through Commerce Manager?


Dec 11, 2018 5:45

I think you are missing the code to save the Dto, out of my head this would be needed



Dec 11, 2018 9:40

Interesting. We have added that code and still have to test it. Why would it still work sometimes and at times not? With out current code there is a row in the payment method table. Does the code you sent above add another row of data somewhere else? Does the paymentMethod.SaveChanges() not do the same thing?

Edited, Dec 11, 2018 12:38

Hi Quan,

Thank for your response.

We removed the payment method from the CMS site and manually added it. But still the above said error exists, when going to do the payment.

Could you please let us know any further steps which we could try?

Thank you.

Jan 14, 2019 4:36

Hi Nalin,

I saw that you got this problem in some cases, not for all. Please notify that a payment method could be limited by markets and language. So please make sure that your payment method is setting for all available markets and you should have a payment method for every language too.

Hope this help

Jan 14, 2019 5:40

Hi Binh,

Thanks for you response.

As you said we have tried the steps what you have mentioned, but didn't give expected response and still the error throwing as "Specified payment method " {payment.PaymentMethodId)}" has not been defined."

Hope I could have a solution soon, since our production go live date is closing...

Thank you.

Edited, Jan 15, 2019 4:41

I think you can log more information in the exception case to know exact  problem here such as PaymentMethodId, current language, current market. Then you can check if payment method setting for that PaymentMethodId is available in Commerce Manager or not

Jan 15, 2019 5:34

Hi Binh

I am sending this post on Nalin's behalf as he is unable to post images/image links. We have added screenshots of the configuration and the stack trace. Please note that the payment method is not working for a default market user. Just another thing to note is that this payment method was working before for these particular users and then stopped working. The user we tested with is in the default market.

Edited, Jan 16, 2019 1:45
* 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.