The device-to-device (D2D) networks bear a close resemblance to future Internet-of-Things (IoT) networks. IoT plays a significant role in the FinTech industry, especially in data security and context-aware applications. D2D communication in cellular networks has emerged as a competent technology for the upcoming future cellular networks. To improve spectral efficiency and data secrecy, we propose a two-phase network coding-based two-way decode-and-forward (DF) relaying policy for D2D communication. First, a suitable relay node is selected considering the end-to-end signal-to-interference-plus-noise ratio (SINR). Then, an XOR-based DF operation is performed when the signal transmitted by both the D2D users (DUEs) is successfully decoded at the relay node. In order to analyze the performance of the proposed two-way communication system, we derive the outage probability expression as a function of various system parameters, such as the SINR, position of both the relays and DUEs, power splitting factor, number of relays, and data rate. Furthermore, we also derive an expression for the error probability and average throughput of the D2D link to evaluate a fair comparison of the proposed approach with the traditional methods. The analytical results are also validated with the simulation results to justify the efficacy of the proposed method.