I dont get the live price from Dynamics through tha API.
Is it correct that the API currently does not work with the live price provider?
Developer forum
E-mail notifications
Get live price from /dwapi/ecommerce/products
Replies
Hi Martin,
can you share your request and what live integration do you use?
Is it Dynamicweb.Ecommerce.DynamicwebLiveIntegration.dll?
What is its version?
BR, Dmitrij
Hi Dmitriy!
Was not clear about which API I was talking about.
I meant the WebAPI https://doc.dynamicweb.com/dwapi/docs
Is this API supposed to return live prices from the LivePriceProvider, given everything is setup correctly?
Lets say the /dwapi/ecommerce/carts/{secret} will it calculate the basket by sending it to the ERP and back?
Hey Martin,
It seems like all function on that API only looks down into the database for getting products, so it doen't seems like it does any call to the Live Integration.
The same goes with the carts, so my theory is that we have not got to that point (implementing live prices yet)
Cheers
Matthias
Thanks Matthias. I suspected that was answer.
Can you please find out if there are any plans on making it compatible with the LiveIntegration within the next few months?
if you use /dwapi/* calls all calculations of prices works the same way as the rest of DW.
But there is a number of things to consider.
The webapi does not have any context - so you have to send in things like currency, country (for vat) etc. Also if you have a user, you will first have to authenticate them on the users endpoint, get back the JWT token and send that along as a bearer token to the /products endpoint. If you do not send a bearer token, the request is considered anonymous - and some live integrations are not asking for live prices for anonymous users.
Further, you need one of the latest versions of liveintegrationv2 dlls to have support. The reason is that earlier version of live integration priceproviders make use of GetCurrentuser() which is depending on sessions - and there are no sessions when running in the context of the webapi. So latest version so liveintegration uses another internal method to get the currentuser that is not depending on the session, but on the new pricecontext (9.12 feature) that is send to findprice....
So with those in mind, it should work.
I agree we need some documentation and a bit of QA on this. Will queue it up!
BR Nicolai
Thanks Nicolai!
We are using DW 9.12.5 with the following LiveIntegration dll. Should be enough then right?
Dynamicweb.Ecommerce.DynamicwebLiveIntegration, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Build date Fri, 26 Nov 2021 13:51
We do authenticate the user with /dwapi/users/authenticate, send the bearer token as part of the request to /dwapi/ecommerce/products/{id} and
/dwapi/ecommerce/carts/{secret} to get the price and calculate the cart.
Still, we do not get the correct live price. It is working perfect in our Swift frontend though. So the live integration setup is correct.
This is btw how I do the fetch using Axios:
`/dwapi/ecommerce/products/${id}`,
{
params: {
LanguageId: 'nb-no',
CurrencyCode: 'NOK',
CountryCode: 'NO',
ShopId: 'SHOP1'
},
headers: {
'Authorization': `Bearer ${token}`
}
}
)
I see now that I do get the anonymous price from the live integration using this code. It does not take the user into consideration. What am I missing?
Does not look like any of the Cart endpoints trigger any LiveIntegration calculations either...
We do not even get anonymous prices from ERP, we get the Price Matrix prices from DW.
Is it so that we cant use the dwapi for anything related to LiveIntegration?
Hi Martin,
As NP mentioned the prices are calculated in the exact same manner using webapi, as in retrieving prices in frontend. The LiveIntegration relies on the use of PriceProvider to calculate prices. This provider is triggered whenever prices are requested, and is triggered from webapi as well.
So, from a technical perspective it should be working. I will review the LiveIntegration to see if any clues are in there. Also, can you pass a URL for me to check settings?
BR
Snedker
Thanks Morten! I will send you details in an email.
You must be logged in to post in the forum