== payment_transactions.refund ==
=== Description ===
Refunds transaction. This is just a proxy method to payment API - transaction.refund with same input params and results.
IMPORTANT:
Refund must be performed against appropriate system's url(system_id, retrieved by payment_subscriptions.search)
```
if system_id == m21
staging: https://cs-m21.dvipdev.com/
production: https://cs-m21.dvipapp.com/
```
==== Input Parameters ====
<table>
<tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th><th>Note</th></tr>
<tr><td>tran_id</td><td>int</td><td>Yes</td><td>Transaction ID</td><td>Transaction that will be refunded</td></tr>
<tr><td>amount</td><td>float</td><td>No</td><td>Amount to be refunded</td><td>If omitted, full amount will be refunded</td></tr>
</table>
==== Return ====
<table>
<tr><th>Name</th><th>Type</th><th>Description</th><th>Note</th></tr>
<tr><td>success</td><td>bool</td><td>Was transaction refunded successfully?</td><td></td></tr>
</table>
==== Usage Example ====
example query:
```
/api.json?cmd=payment_transactions.refund&tran_id=117330
```
example of successfully refunded response
```lang=json
{
"meta": {
"status": "OK"
},
"result": {
"success": true,
}
}
```
example of failure response(already refunded):
```lang=json
{
"meta": {
"errors": [
{
"code": "614: [102] Cannot Credit - A credit operation cannot be performed because the original transaction has already been voided, credited, or has not been settled.",
"params": null,
"sticky": false,
"text": "614: [102] Cannot Credit - A credit operation cannot be performed because the original transaction has already been voided, credited, or has not been settled."
}
],
"status": "ERROR"
},
"result": {
"success": false
}
}
```