...
Note: You can only issue a refund on a Successful transaction.
...
Set up Webhook Event and add charge.refunded.
...
Click Add Events and after that, click Add Endpoint
Setup Payment Refund Button
In Gateway Transaction, add a Payment Refund button on the page layout
Refund Payment Functionality
...