Developer forum

Forum » Development » RedirectToCart(Order) callback

RedirectToCart(Order) callback

Tomislav Bušić
Reply

Hi guys,

I'm passing the payment url through PayCek callback,

I found an example in the documentation on Dynamicweb https://doc.dynamicweb.com/documentation-9/api/apis/api-docs#article=Dynamicweb.Ecommerce.Cart.CheckoutHandler.

Does anyone have an idea what the callback should look like?

public string Test(Order order)
        {
            var portString = HttpContext.Current.Request.Url.IsDefaultPort ? "" : string.Format(":{0}", HttpContext.Current.Request.Url.Port);
            var pageId = Dynamicweb.Context.Current.Request["ID"] == null ? string.Empty : string.Format("ID={0}&", Dynamicweb.Context.Current.Request["ID"]);
            //Url
            var myUrl = string.Format("{0}://{1}{2}/Default.aspx?{3}{4}={5}",
            HttpContext.Current.Request.Url.Scheme,
            HttpContext.Current.Request.Url.Host,
            portString,
            pageId,
            OrderIdRequestName,
            order.Id);

            return myUrl;
        }

INVALID URL - MUST BE PUBLIC: {'URL': 'HTTP://192.168.5.29/DEFAULT.ASPX?

ID=1844&CHECKOUTHANDLERORDERID=ORDER1135'}

Thanks in advance.

BR 

Tomislav

forum_question.png

Replies

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply
This post has been marked as an answer

You need to setup a website with a public URL which can be called from PayCek.
You should also configure the site with SSL/TLS and use https instead of http in the URL.

/Morten

Votes for this answer: 1
 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
This post has been marked as an answer

Or you can use Ngrok (https://ngrok.com/) to set up a connection from an external, Ngrok hosted URL that maps to a local URL. Here's how:

1. Get Ngrok
2. Configure Ngrok to connect to your local port. More in their docs, but something like this:
ngrok http http://localhost:80 --host-header="localhost:80"
3. That gives you a URL like this: https://d8e1-2a02-a46c-47e4-1-e19f-8A60-5632-586c.ngrok-free.app
4. You can feed that URL + the path to your provider (i.e https://d8e1-2a02-a46c-47e4-1-e19f-8A60-5632-586c.ngrok-free.app/Default.aspx?ID=1234)
5. When the provider makes the callback, Ngrok will reroute the request to your machine where it gets redirected to your localhost site.

Hope this helps,

Imar

Votes for this answer: 1
 
Tomislav Bušić
Reply

Thanks guys, 

Thanks for your help, 

I'll try to solve it that way.

Best regards, 

Tomislav

 

You must be logged in to post in the forum