Developer forum

Forum » Development » Payment provider - separate callback url

Payment provider - separate callback url

Ivan Marijanović
Ivan Marijanović
Reply

Hi guys

I am implementing payment provider which have separate callback url on which they send informations on changes in transaction status. 

This is from documentation: "Merchant can offer an URL endpoint where data will be sent, using HTTP POST method, on every successful change of transaction status. So, if the transaction is preauthorized, authorized, completed, voided or refunded, PayWay will send relevant information at provided URL. After merchant has implemented the endpoint on their side, they must deliver URL endpoint to PayWay so it can be configured. PayWay can send transaction report through standard ports for HTTP and HTTPS. If custom port must be used, then available ports are the ones in range from 50001 to 50010."

This is different url then cart/order return url  and is important because sometimes clients after making payments do not wait for provider to retunr to shop page so the trnasaction in DW is not set to completed even the payment is made.

My question is how to implement listener (I presume using Notificaiton subscriber) on some end point (for example /payway/callback) that can get this post request and check if order is set to completed or not and make needed cahens to order (which notification subscribers). Examples of paymentproviders (for example QuickPay) have this done inside the return url.

Thank you in advance!

Ivan


Replies

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Ivan,

Normally, callbacks are handled by the cart. It will then determine that it needs to forward the request to your checkout handler implementation. From there, you can do what you need to. If that is insufficient for the specific gateway, you need to create an endpoint that can handle the callbacks. Just be aware that it's a little more involved than if you let the cart handle it for you.

The easiest way to get the callback to come back to the cart is to use the url generated by the protected method CheckoutHandler.GetBaseUrl(Order), which you have access to from your CheckoutHandler implementation. You can add additional arguments to that url to tell your implementation what it needs to do when a callback comes in.

You can see some examples of how some of our checkout handlers are implemented on GitHub: https://github.com/orgs/dynamicweb/repositories?type=all&q=checkouthandlers

I hope this helps.

- Jeppe

 

You must be logged in to post in the forum