Developer forum

Forum » Development » Capture from outside Dynamicweb

Capture from outside Dynamicweb

Anders Ebdrup
Anders Ebdrup
Reply

Dear Dynamicweb,

 

Is it somehow possible to capture orders without logging into the Dynamicweb admin so we can have ERP-system call Dynamicweb and then Dynamicweb will capture the amounts?

 

I was hoping that something like this is possible:

http://www.shopurl.com/admin/module/ecom_catalog/dw7/ordercapture.aspx?ajax=Capture&captureorderID=ORDER785&SplitAmount=False&CaptureAmount=10

Best regards, Anders


Replies

 
Nicolai Pedersen
Reply

What about this: 

https://doc.dynamicweb.com/other/tools/ecommerce-web-api#8213

It depends on the underlying payment gateway - it has to support remote capture etc. So if you cannot do it from the backend, you can also not do it here.

This controller might have received some updates compared to what is in the docs.

BR Nicolai

 
Anders Ebdrup
Anders Ebdrup
Reply

Dear Nicolai,

 

Thank you very much! I have tried the endpoint, but with no success.

Please see this postman example: https://www.screencast.com/t/NR36Uchq. Can you see what I am doing wrong?

 

Best regards,

Anders

 
Nicolai Pedersen
Reply

It looks like some kind of external authentication that comes on top...? Did you set some of that up?

 
Anders Ebdrup
Anders Ebdrup
Reply
Nope
 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

The error ID seems to suggest it's Azure AD....

 
Anders Ebdrup
Anders Ebdrup
Reply

When looking into the code with dotpeek, I see this:

 

  [RoutePrefix("dwapi/payments")]
  [ApiExplorerSettings(IgnoreApi = true)]
  [BasicAuthentication]
  [Obsolete]
  public class OrderPaymentsController : ApiController

So maybe this controller has some sort of authentication??

 
Nicolai Pedersen
Reply

Hi Anders

Yes - you have to authenticate using basic authentication and a username/password from admin that has admin rights to capture an order. Otherwise anyone could do it.

Using fetch you can do it like this:

let headers = new Headers();
headers.set('Authorization', 'Basic ' + window.btoa(username + ":" + password));
fetch(url, {method:'POST',
        headers: headers
       })

BR Nicolai

 
Anders Ebdrup
Anders Ebdrup
Reply

Hi Nicolai,

 

I have setup "basic authentication" in Postman, but still with no luck: https://www.screencast.com/t/vWDHvres3h3

Any thought of what I am doing wrong here?

 

Best regards,

Anders

 
Nicolai Pedersen
Reply

Hi Anders

It seems like a bug related to your authentication as we have moved the authentication attribute as part of getting rid of System.Web in the core APIs. We have made a bugfix on #2386 which is part of the next release of the Dynamicweb.Ecommerce.WebAPI package.

Sorry about the inconvenience!

BR Nicolai

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply
This post has been marked as an answer

Hi Anders

Bugfix #2386 is also part of the 9.10.10 release

Download: https://doc.dynamicweb.com/downloads/releases

Kind Regards
Dynamicweb Support
Kristian Kirkholt

Votes for this answer: 1

 

You must be logged in to post in the forum