Refund & Stop
Refund & Stop
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
Name | Type | Required | Description | Note |
---|---|---|---|---|
sub_id | int | Yes | Subscription ID | Subscription that will be stopped |
tran_id | int | Yes | Transaction ID | Transaction that will be refunded |
pp_type | string | No | Payment Processor Type | If not passed will be retrieved from subscription/transaction payment data |
Return
Name | Type | Description | Note |
---|---|---|---|
success | bool | Is subscription stopped and is transaction refunded? | Checks state for both transaction and subscription - returns true if transaction is refunded and subscription is stopped - also true if transaction was refunded before, and/or subscription stoppped before. |
refunded | bool | Is transaction refunded? | Checks transaction state - true if transaction is(or already was) refunded |
stopped | bool | Is subscription stopped? | Checks subscription state - true if subscription is(or already was) stopped |
Usage Example
example query:
/api.json?cmd=payment_subscriptions.refund-stop&tran_id=117303&sub_id=14624&pp_type=RG
example of successful execution:
{ "meta": { "messages": [ { "code": "refund_success", "params": null, "sticky": false, "text": "refund_success" } ], "status": "OK" }, "result": { "success": true, "refunded": true, "stopped": true, "id": 0, "data": [ ], "item": [ ] } }
Example of repeated call after successful one:
{ "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": true, "refunded": true, "stopped": true, "id": 0, "data": [ ], "item": [ ] } }
Example of failed execution(refund failed - transaction is not refunded), subscription stopped successfully
{ "meta": { "errors": [ { "code": "820: Can't find matching transaction", "params": null, "sticky": false, "text": "820: Can't find matching transaction" }, { "code": "refund_failed", "params": null, "sticky": false, "text": "refund_failed" } ], "status": "ERROR" }, "result": { "success": false, "refunded": false, "stopped": true, "id": 0, "data": [ ], "item": [ ] } }
Referenced Files
None
Subscribers
None
- Last Author
- asimic
- Last Edited
- Apr 4 2017, 09:55