React to a completed donation — log it, send a follow-up, or update a list
When a listener completes a donation, you probably want to do something with that — log it to a CRM, add the donor to an email list, push a Slack notification, or trigger a custom thank-you sequence. This recipe shows where to hook in.
benecaster_donation_received fires after Stripe confirms payment and carries the real transaction amount, currency, and full payment details. This is the right hook for anything financial — logging, receipts, analytics. If you also support link-mode donations (where listeners pay via a direct payment link rather than the embedded widget), benecaster_listener_support_donation_logged covers both modes in one callback.
You can also add markup directly to the donation widget: benecaster_before_donation_form fires just before the widget renders (useful for legal copy or a short message), and benecaster_after_donation_confirmation fires inside the confirmation panel that appears after a successful payment (useful for a next-step link or social share prompt).
Code
<?php
add_action( 'benecaster_before_donation_form', function ( int $show_id ): void {
printf( '<p class="legal">%s</p>', esc_html__( 'Donations are non-refundable.', 'my-plugin' ) );
} );
add_action( 'benecaster_after_donation_confirmation', function ( int $show_id, float $amount, string $currency ): void {
// Amount is 0/USD at server-render time. Use benecaster_donation_received
// for the real per-donation amount, fired from the Stripe webhook.
echo '<p><a href="/thanks/">Continue browsing →</a></p>';
}, 10, 3 );
add_action( 'benecaster_donation_received', function ( int $show_id, float $amount, string $currency, array $intent, int $donation_id ): void {
// Real amount in major units (e.g. 15.00 USD), full PaymentIntent array.
my_crm_log_donation( $show_id, $amount, $currency, $intent['id'] );
}, 10, 5 );