Partial refund
Last updated: 19-May-2021
Rate this article:
Overview
Use the issueRefund method to issue a partial refund for an order processed by 2Checkout.
Requirements
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 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 TotalPrice > 0.
The OrderDate cannot be older than a year from the current date.
To obtain the LineItemReference, use the getOrder method: https://knowledgecenter.2checkout.com/API-Integration/JSON-RPC_API_6.0/Reference/14Retrieve-an-order
Request example
require ('PATH_TO_AUTH'); // authentication call
$orderReference = "11686290";
$items = [];
$item = new stdClass();
$item->Quantity = 1;
$item->LineItemReference = "f1ca85810f935115ef8dacd6aae4b1759f4f03c1";
$item->Amount = 0.1;
$items[] = $item;
$amount = '20';
$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++;
$partialRefund = callRPC($jsonRpcRequest, $host);
var_dump ($partialRefund);
Response
Response | Type/Description |
---|---|
Boolean |
TRUE is the refund was processed successfully FALSE otherwise |
Related articles
Rate this article: