PayPal\Service\AdaptivePaymentsService::Refund PHP Méthode

Refund() public méthode

Service Call: Refund
public Refund ( RefundRequest $refundRequest, mixed $apiCredential = NULL ) : Types\AP\RefundResponse
$refundRequest RefundRequest
$apiCredential mixed - Optional API credential - can either be a username configured in sdk_config.ini or a ICredential object created dynamically
Résultat Types\AP\RefundResponse
    public function Refund($refundRequest, $apiCredential = NULL)
    {
        $ret = new RefundResponse();
        $apiContext = new PPApiContext($this->config);
        $handlers = array(new PPPlatformServiceHandler($apiCredential, self::$SDK_NAME, self::$SDK_VERSION));
        $resp = $this->call('AdaptivePayments', 'Refund', $refundRequest, $apiContext, $handlers);
        $ret->init(PPUtils::nvpToMap($resp));
        return $ret;
    }

Usage Example

}
/*
 * The tracking ID associated with the payment that you want to refund
 */
if ($_POST['trackingId'] != "") {
    $refundRequest->trackingId = $_POST["trackingId"];
}
/*
* 	 ## Creating service wrapper object
Creating service wrapper object to make API call and loading
Configuration::getAcctAndConfig() returns array that contains credential and config parameters
*/
$service = new AdaptivePaymentsService(Configuration::getAcctAndConfig());
try {
    /* wrap API method calls on the service object with a try catch */
    $response = $service->Refund($refundRequest);
} catch (Exception $ex) {
    require_once 'Common/Error.php';
    exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>PayPal Adaptive Payments - Refund</title>
<link href="Common/sdk.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Common/sdk_functions.js"></script>
</head>

<body>
	<div id="wrapper">