WC_Gateway_Paypal_Refund::refund_order
Process an order refund.
Method of the class: WC_Gateway_Paypal_Refund{}
No Hooks.
Returns
Object. Either an object of name value pairs for a success, or a WP_ERROR object.
Usage
$result = WC_Gateway_Paypal_Refund::refund_order( $order, $amount, $reason, $sandbox );
- $order(WC_Order) (required)
- Order object.
- $amount(float)
- Refund amount.
Default:null - $reason(string)
- Refund reason.
Default:'' - $sandbox(true|false)
- Whether to use sandbox mode or not.
Default:false
WC_Gateway_Paypal_Refund::refund_order() WC Gateway Paypal Refund::refund order code WC 10.7.0
public static function refund_order( $order, $amount = null, $reason = '', $sandbox = false ) {
if ( $sandbox ) {
self::$sandbox = $sandbox;
}
$result = self::refund_transaction( $order, $amount, $reason );
if ( is_wp_error( $result ) ) {
return $result;
} else {
return (array) $result;
}
}