|
/ Documentation /Developer Hooks & Events/ suredonation_donation_refunded Action Hook

suredonation_donation_refunded Action Hook

Overview

The suredonation_donation_refunded action fires when a donation is refunded – fully or partially – specifically when the cumulative refunded amount increases as a result of an update. It provides both the amount refunded in this event and the running total.

Hook Signature

do_action( 'suredonation_donation_refunded', $donation_id, $refund_amount, $total_refunded, $payload );

Parameters

  • $donation_id _(int)_ – The refunded donation’s ID.
  • $refund_amount _(float)_ – The amount refunded in this event (the delta, not the running total).
  • $total_refunded _(float)_ – The cumulative amount refunded to date on this donation.
  • $payload _(array)_ – The curated, integration-safe donation payload from Donations::get_integration_payload(), reflecting the post-update state. See suredonation_donation_created for the full key list.

Usage

add_action( 'suredonation_donation_refunded', 'your_custom_function', 10, 4 );

function your_custom_function( $donation_id, $refund_amount, $total_refunded, $payload ) {

    // Your custom logic here.

}

Example

add_action( 'suredonation_donation_refunded', 'mysite_record_refund', 10, 4 );

function mysite_record_refund( $donation_id, $refund_amount, $total_refunded, $payload ) {

    error_log( sprintf(

        'Donation #%d refunded %s %.2f (%.2f total refunded)',

        $donation_id,

        $payload['currency'],

        $refund_amount,

        $total_refunded

    ) );

}

Related Hooks

  • suredonation_donation_status_changed
  • suredonation_donation_completed
Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
Table of Contents
Scroll to Top