Developer forum

Forum » Development » NETS payments integration issue

NETS payments integration issue

Karol Barkowski


I am trying to integrate NETS/DIBS Easy payments in DW 9. During the checkout i got an error from DibsEasyCheckout:

En feil har oppstått
**Payment request failed with following errors: { "notifications.WebHooks[0].Url": [ "Field is not accepted as a valid URL" ] }**


Do someone know why this error appears and what could cause it ? Is it something form our side or NETS ?
Stack trace from logs:
-------: Unhandled exception with message: Payment request failed with following errors: {   "notifications.WebHooks[0].Url": [
 "Field is not accepted as a valid URL"   ] }. System.Exception: Payment request failed with following errors: {   "notifications.WebHooks[0].Url": [
 "Field is not accepted as a valid URL"   ] }
at Dynamicweb.Ecommerce.CheckoutHandlers.DibsEasyCheckout.DibsEasyCheckout.ExecuteRequest(WebRequest request)
at Dynamicweb.Ecommerce.CheckoutHandlers.DibsEasyCheckout.DibsEasyCheckout.ExecutePostRequest(String function, Object body, String method)
at Dynamicweb.Ecommerce.CheckoutHandlers.DibsEasyCheckout.DibsEasyCheckout.RenderPaymentForm(Order order, Template formTemplate)
2024-07-04 08:49:48.140: Request headers: [   "Cache-Control",   "Connection",   "Content-Length",   "Content-Type",   "Accept",   "Accept-Encoding",   "Accept-Language",   "Cookie",   "Host",   "Referer",   "User-Agent",   "Upgrade-Insecure-Requests",   "Origin" ]
------: Request item keys: [   "IsWebServiceConnectionAvailable",   "owin.Environment",   {},   "PagePermissionWithInheritanceFrontend6765",   "Neros.LiveIntegration.ShopId",   "UserManagement.GetUserById.18324",   "MS_HttpRequestMessage",   "AspSession",   "PermissionContextStack",   "Neros.LiveIntegration.Settings",   "Dynamicweb.OMC.VisitorEngagementSettings.Config",   "Dynamicweb.OMC.VisitContext",   "Neros.LiveIntegration.Api.Logger",   "AspSessionIDManagerInitializeRequestCalled",   "EcomCart:CustomCartContext",   "alternateUrlKey",   "ExecutionTableMapper",   "PagePermissionWithInheritanceFrontend6861",   "DWPAGEVIEW",   "EcomCartDiscountsAndTaxesAreHandled",   "Dynamicweb.Environment.Web",   "Dynamicweb.Tracking.Tracker",   "IsLazyLoadingForProductInfoEnabled" ]
------: Request form: [   "QuantityOrderLineOL49693",   "CustomCustomerName",   "EcomOrderCustomerName",   "EcomOrderCustomerAddress",   "EcomOrderCustomerZip",   "EcomOrderCustomerCity",   "EcomOrderCustomerCountry",   "EcomOrderCustomerEmail",   "ShippingAddressSelector",   "EcomOrderDeliveryCompany",   "EcomOrderDeliveryName",   "EcomOrderDeliveryPhone",   "EcomOrderDeliveryEmail",   "EcomOrderDeliveryAddress",   "EcomOrderDeliveryZip",   "EcomOrderDeliveryCity",   "EcomOrderDeliveryCountry",   "EcomCartPaymethodId",   "EcomOrderSavedCardName",   "NotificatioOnParcel",   "PoNumber",   "CustomCustomerComment",   "EcomCartShippingmethodId",   "SHIP31_BringSelectedOptionId",   "EcomOrderCustomerAccepted",   "CartV2.GotoStep1" ]


Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen

Hi Karol

Can you show the setup of the checkouthandler in DW and inside Nets easy?

The error indicates that the callback URL is missing or wrongly defined. It could be that you run locally and the calculated callback URL is like localhost:6000 which NETs would see as an invalid URL.

So a couple of screenshots of your setup would be nice.

BR Nicolai

Karol Barkowski


It is running on stage.
The setup in handler look like that:




I am able tor prepare correct Postman call but here it seem like you said DW is not preparing Webhook url properly.
We don't have access to NETS easy setup. We only got required keys.

Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen

The provider generates a URL based on the host you run locally. What host and port do you run locally?

Is it localhost:6000 or similar? That could be rejected by dibs as they will never be able to make a callback to a localhost.

What webhook URL do you add in the POSTMAN?

Also if you are running on a port different from 80 or 443, and the setting /Globalsettings/System/http/DisableBaseHrefPort is set to true, a port is not added to the callback URL passed to NETs. Not that I think that is the issue...

Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen

When you start the payment locally - have a look in your devtools, network tab, what is being sent to NETS

Karol Barkowski

I am not testing it locally because based on project specification we run application on stage env and on stage env we get this error.
The url on env looks similar to that:
When I was testing it locally on postman, localhost url was accepted by DIBS. Sample call just bear in mind it is prepare for test:

 "notifications": {
    "webHooks": [
        "eventName": "payment.created",
        "url": "https://localhost:7055/Callback",
        "authorization": "authorization_id",
        "headers": null

DisableBaseHrefPort is set to false

Karol Barkowski

Hi Nicolai

I think we found what is wrong, it silly thing but url is producing with http, not with https as staging don’t have ssl turn on.
I don’t know how we can achieve this yet.

But in meantime I have another question in url we have something like this:
Can you explain what that url meant?  because it is callback url so NETS will call under this with updates when specific event appears ? or is there something more ? and is there possibility to catch and interfere when this call will happened or maybe we shouldn’t do this ?

Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger

Hi Karol,

The url, as you point out, is meant for having NETS call back to DW with payment updates in the context of the checkout flow. You can intercept and log the request in you own middleware if you want, but you should not manipulate or block it as that most likely will interfere with the registration of payment updates. Be aware that if you log the request, specifically the body, you may run into GDPR issues.

Callback urls, specifically, are used to tell DW with the customer has completed, or has tried to complete, payment. Payment could have succeeded, payment could have been rejected due to suspicion of fraud, and so on. It's not used if you access the merchant account at NETS and make changes there.

Structurally, the url consists of three parts (not counting the scheme and domain): the path to the page where the cart app is located, an indicator to the cart app that the request should be handled by a checkout handler and, finally, the parameters needed by the checkout handler to determine which type of processing it needs to do. In addition, NETS sends information in the body of the request which is also read by the checkout handler. The first two are the same across checkout handlers but the parameters can vary.

There are other types of urls used by checkout handlers. Usually, they are OK and Cancel urls, but some checkout handlers have other urls as well. The OK url is used when the customer has completed payment and needs to be redirected back to the receipt. The Cancel url, as the name suggests, redirects the customer in case they cancel their payment.

I hope that clarifies the purpose and structure of the url, otherwise let me know.

- Jeppe

Karol Barkowski

Hi Jeppe

thanks for that explanation.
We hit another problem with inline form and maybe you know what could be a reason.
When I want to use inline form and I click pay:

It will redirect me to url like this:

And this is throwing error:
En feil har oppstått
Object reference not set to an instance of an object.

I also assume that when I have an inline form set in the admin panel, the payment template will be rendered as one of the block of checkout page (one-page checkout). In our case, when we submit form, the next step should be the order summary. However, we are currently moving to the  payment template instead:

Do you think this might be connection with error during payment processing for inline form or maybe this is with something else?
We are using nuget for DW 9 and also older one .




You must be logged in to post in the forum