To display the link it's just those couple lines of XML. See the below for example.
components/com_comprofiler/plugin/user/plug_cbpaidsubscriptions/processors/dummy/edit.gateway.xml
Specifically the below.
Code:
<view name="paymentstatusinformation" type="params" ui="admin">
<showview view="paymentrefundbutton" mode="view" type="view" />
</view>
The processing of the refund is done by the refundPayment function of the gateway. See the below for example.
components/com_comprofiler/plugin/user/plug_cbpaidsubscriptions/processors/dummy/cbpaidsubscriptions.dummy.php