Developer forum

Forum » Development » PaymentFee Provider

PaymentFee Provider

Jesper Splidsboel
Reply

I need to calculate PaymentFee (free paymentfee for some products). Where do I find a PaymentFee provider like the FeeProvider (only for ShippingFee) ?


Replies

 
Nicolai Pedersen
Reply

There is no provider for that one since payments are handled by the checkouthandler.

You can however use th Notifications.Ecommerce.Order.BeforePaymentFeeCalculation notification and set the PaymentFee property on the BeforePaymentFeeCalculationArgs passed to the notification to a PriceInfo instance. If that one is not null, the value of that priceinfo is used as the payment fee - otherwise the payment fee is calculated by DW.

BR Nicolai

 
Jesper Splidsboel
Reply

The PaymentFee property is readonly so your solution is not possible. Do you have another workaround ?

 
Nicolai Pedersen
Reply

Can see that. Made #1557 to make the property public - will be out with next Dynamicweb.Ecommerce package.

BR Nicolai

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Nicolai,

Trying to implement the same thing and ran into the same issue: PaymentFee is readonly still, even in very recent versions of Dynamicweb.

What is the recommended way to add a custom (payment) fee to an order? We tried  setting the fee directly on args.Order. That leads to stack overflow issues (that we can work around) but before we dig deeper into this,. I want to make sure we do the right thing, and assigning fees directly to the order doesn't feel right ;-)

In summary, we like to add a custom (payment) fee to an order based on the current user and some custom logic so we can't use the standard fees.

Thanks!

Imar

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Bump. Anyone?

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply
This post has been marked as an answer

Hi Imar,

Just to be clear, it's not the PaymentFee property on Order that's been changed, rather it's the one on BeforePaymentFeeCalculationArgs. That property has been settable since Dynamicweb.Ecommerce.1.10.32 and still is in the latest 1.10.87. If you're not seeing this, try clearing your local NuGet cache and make sure you're not using any Dynamicweb feeds from MyGet.

- Jeppe

Votes for this answer: 1
 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Thanks Jeppe. Turned out we were using an old NuGet package without realizing it.

Imar

 

 

You must be logged in to post in the forum