Use the issueRefund method to issue a total refund for an order processed by 2Checkout.
The payment for the refundable order needs to be collected.
You cannot issue a refund for an amount higher than the total order amount.
We recommend you to create a new order with placeOrder to have one that can be refunded.
The order’s status must be ’COMPLETE’ and it should have a Total price.
The order’s date cannot be older than a year from the current date.
To obtain LineItemReference, use the getOrder method: https://knowledgecenter.2checkout.com/API-Integration/JSON-RPC_API_6.0/Reference/14Retrieve-an-order
require ('PATH_TO_AUTH'); // authentication call $orderReference = "11714895"; $items = ; $amount = '50'; $comment = "This is a comment"; $reason = "No reason"; $jsonRpcRequest = new stdClass(); $jsonRpcRequest->jsonrpc = '2.0'; $jsonRpcRequest->method = 'issueRefund'; $jsonRpcRequest->params = array($sessionID, $orderReference, $amount, $items, $comment, $reason); $jsonRpcRequest->id = $i++; $totalRefund = callRPC($jsonRpcRequest, $host); var_dump ($totalRefund);
TRUE is the refund was processed successfully