Is it possible to make a refund via the API?

Follow

 Of course it is. However, you need to manually activate this option from your profile. 

To do this, sign in to your account, go to Settings / API Access, and make sure the ‘Allow refunds via the API’ option is checked.

You can now use the CancelTransaction call and make Cancellations.