What happens if a registered person has paid CGST and SGST or, as the case may be, CGST and UTGST on a transaction considered by him to be an intra-state supply but which is subsequently held to be an inter-state supply

Refund of CGST and SGST or, as the case may be, CGST and UTGST shall be granted in such manner and subject to such conditions as may be prescribed.

(ICAI FAQ PUBLICATIONS 06-09-2017 Tax wrongfully collected and paid to Central Government or State Government : FAQ NO. 36)