PayPal\Service\PayPalAPIInterfaceServiceService::RefundTransaction PHP Method

RefundTransaction() public method

Service Call: RefundTransaction
public RefundTransaction ( RefundTransactionReq $refundTransactionReq, mixed $apiCredential = null ) : RefundTransactionResponseType
$refundTransactionReq PayPal\PayPalAPI\RefundTransactionReq
$apiCredential mixed - Optional API credential - can either be a username configured in sdk_config.ini or a ICredential object created dynamically
return PayPal\PayPalAPI\RefundTransactionResponseType
    public function RefundTransaction($refundTransactionReq, $apiCredential = null)
    {
        $apiContext = new PPApiContext($this->config);
        $handlers = array(new PPMerchantServiceHandler($apiCredential, self::$SDK_NAME, self::$SDK_VERSION));
        $this->setStandardParams($refundTransactionReq->RefundTransactionRequest);
        $ret = new RefundTransactionResponseType();
        $resp = $this->call('PayPalAPI', 'RefundTransaction', $refundTransactionReq, $apiContext, $handlers);
        $ret->init(PPUtils::xmlToArray($resp));
        return $ret;
    }

Usage Example

Beispiel #1
0
$refundReqest->Memo = $_REQUEST['memo'];
/*
* 
  (Optional) Maximum time until you must retry the refund. 
*/
$refundReqest->RetryUntil = $_REQUEST['retryUntil'];
$refundReq = new RefundTransactionReq();
$refundReq->RefundTransactionRequest = $refundReqest;
/*
 * 	 ## Creating service wrapper object
Creating service wrapper object to make API call and loading
Configuration::getAcctAndConfig() returns array that contains credential and config parameters
*/
$paypalService = new PayPalAPIInterfaceServiceService(Configuration::getAcctAndConfig());
try {
    /* wrap API method calls on the service object with a try catch */
    $refundResponse = $paypalService->RefundTransaction($refundReq);
} catch (Exception $ex) {
    include_once "../Error.php";
    exit;
}
if (isset($refundResponse)) {
    echo "<table>";
    echo "<tr><td>Ack :</td><td><div id='Ack'>{$refundResponse->Ack}</div> </td></tr>";
    //echo "<tr><td>RefundStatus :</td><td><div id='RefundStatus'>$refundResponse->RefundInfo->RefundStatus</div> </td></tr>";
    echo "</table>";
    echo "<pre>";
    print_r($refundResponse);
    echo "</pre>";
}
require_once '../Response.php';
All Usage Examples Of PayPal\Service\PayPalAPIInterfaceServiceService::RefundTransaction