KWT I'm not sure it's clear what you are asking here. Maybe try to rephrase your question.
A DEX (decentralised exchange) is part of the Stellar protocol, so there is nothing to implement.
If you create a custom asset and you provide enough liquidity by placing offers on the DEX, then path payments should automatically work.
Just to give a simple example here:
- Issue an asset ABC
- Put in an offer that you are selling 100 ABC for 1 XLM
Now you can do a path payment directly from any asset that has a buy offer against XLM, lets say USD. What will happen in the background is that e.g. 0.7 USD will be exchanged for 1 XLM and then 1 XLM will be exchanged for 100 ABC. But from the perspective of a user it will be a direct payment from 0.7 USD -> 100 ABC.
I hope this example clarifies a bit the confusion.