== payment_subscriptions.refund-stop ==
=== Description ===
Stops user's subscription and refunds transaction. User will be demoted to free access.
IMPORTANT:
Refund-stop 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>sub_id</td><td>int</td><td>Yes</td><td>Subscription ID</td><td>Subscription that will be stopped</td></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>pp_type</td><td>string</td><td>No</td><td>Payment Processor Type</td><td>If not passed will be retrieved from subscription/transaction payment data</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 subscription stopped successfully and was transaction refunded successfullyl?</td><td></td></tr>
</table>
==== Usage Example ====
example query:
```
/api.json?cmd=payment_subscriptions.refund-stop&tran_id=117303&sub_id=14624&pp_type=RG
```
example of successful response:
```lang=json
{
"meta": {
"messages": [
{
"code": "refund_success",
"params": null,
"sticky": false,
"text": "refund_success"
}
],
"status": "OK"
},
"result": {
"success": true,
"id": 0,
"data": [
],
"item": [
]
}
}
```
example of failure response(already refunded&stopped):
```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."
},
{
"code": "refund_failed",
"params": null,
"sticky": false,
"text": "refund_failed"
}
],
"messages": [
{
"code": "err_sub_stopped_canceled",
"params": null,
"sticky": false,
"text": "err_sub_stopped_canceled"
}
],
"status": "ERROR"
},
"result": {
"success": false,
"id": 0,
"data": [
],
"item": [
]
}
}
```