LLMS_Transaction::process_refund_via_gateway( float $amount, string $note = '' )

Processes a refund via the gateway that processed the transaction.


Parameters Parameters

$amount

(float) (Required) The refund amount.

$note

(string) (Optional) Refund order note.

Default value: ''


Top ↑

Return Return

(string|WP_Error) The refund ID or an error object.


Top ↑

Source Source

File: includes/models/model.llms.transaction.php

410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
protected function process_refund_via_gateway( $amount, $note = '' ) {
 
    $gateway = $this->get_gateway();
    if ( is_wp_error( $gateway ) ) {
        return new WP_Error(
            'llms-txn-refund-gateway-invalid',
            sprintf(
                // Translators: %s = the payment gateway ID.
                __( 'Selected gateway "%s" is inactive or invalid.', 'lifterlms' ),
                $this->get( 'payment_gateway' )
            )
        );
    }
 
    if ( ! $gateway->supports( 'refunds' ) ) {
        return new WP_Error(
            'llms-txn-refund-gateway-support',
            sprintf(
                // Translators: %s = the payment gateway admin title.
                __( 'Selected gateway "%s" does not support refunds.', 'lifterlms' ),
                $gateway->get_admin_title()
            )
        );
    }
 
    return $gateway->process_refund( $this, $amount, $note );
 
}


Top ↑

Changelog Changelog

Changelog
Version Description
7.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.