WC_Gateway_Paypal_API_Handler::get_refund_request( WC_Order $order, float $amount = null, string $reason = '' )
Get refund request args.
Description Description
Parameters Parameters
- $order
-
(Required) Order object.
- $amount
-
(Optional) Refund amount.
Default value: null
- $reason
-
(Optional) Refund reason.
Default value: ''
Return Return
(array)
Source Source
File: includes/gateways/paypal/includes/class-wc-gateway-paypal-api-handler.php
public static function get_refund_request( $order, $amount = null, $reason = '' ) {
$request = array(
'VERSION' => '84.0',
'SIGNATURE' => self::$api_signature,
'USER' => self::$api_username,
'PWD' => self::$api_password,
'METHOD' => 'RefundTransaction',
'TRANSACTIONID' => $order->get_transaction_id(),
'NOTE' => html_entity_decode( wc_trim_string( $reason, 255 ), ENT_NOQUOTES, 'UTF-8' ),
'REFUNDTYPE' => 'Full',
);
if ( ! is_null( $amount ) ) {
$request['AMT'] = number_format( $amount, 2, '.', '' );
$request['CURRENCYCODE'] = $order->get_currency();
$request['REFUNDTYPE'] = 'Partial';
}
return apply_filters( 'woocommerce_paypal_refund_request', $request, $order, $amount, $reason );
}