public function refund(Payment $payment, $data = [])
    {
        $resource = "{$this->getResourcePath()}/" . urlencode($payment->id) . "/refunds";

        $body = null;
        if (count($data) > 0) {
            $body = json_encode($data);
        }

        $result = $this->client->performHttpCall(self::REST_CREATE, $resource, $body);

        return ResourceFactory::createFromApiResult($result, new Refund($this->client));
    }
public function refund(Payment $payment, $data = [])
    {
        $resource = "{$this->getResourcePath()}/" . urlencode($payment->id) . "/refunds";

        $body = null;
        if (count($data) > 0) {
            $body = json_encode($data);
        }

        $result = $this->client->performHttpCall(self::REST_CREATE, $resource, $body);

        return ResourceFactory::createFromApiResult($result, new Refund($this->client));
    }
public function refund ( Payment $ payment , $ data = [ ] ) { $ resource = "{$this->getResourcePath()}/" . urlencode ( $ payment -> id ) . "/refunds" ; $ body = null ; if ( count ( $ data ) > 0 ) { $ body = json_encode ( $ data ) ; } $ result = $ this -> client -> performHttpCall ( self :: REST_CREATE , $ resource , $ body ) ; return ResourceFactory :: createFromApiResult ( $ result , new Refund ( $ this -> client ) ) ; }
Issue a refund for the given payment.

The $data parameter may either be an array of endpoint parameters, a float value to
initiate a partial refund, or empty to do a full refund.

@param Payment $payment
@param array|float|null $data

@return Refund
@throws ApiException
Issue a refund for the given payment .