Last active
August 29, 2015 14:24
-
-
Save NikV/39925d1c4a37fc839bc1 to your computer and use it in GitHub Desktop.
Gravity Forms Notification after a payment has been refunded
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Fires after a payment has been refunded | |
* | |
* @param array $entry The Entry object | |
* @param array $action The action object | |
* $action = array( | |
* 'type' => 'cancel_subscription', // Type can be | |
* 'transaction_id' => '', // What is the ID of the transaction made? | |
* 'subscription_id' => '', // What is the ID of the Subscription made? | |
* 'amount' => '0.00', // Amount to charge? | |
* 'entry_id' => 1, // What entry to check? | |
* 'transaction_type' => '', | |
* 'payment_status' => '', | |
* 'note' => '' | |
* ); | |
*/ | |
function gfroms_after_payment_refunded( $entry, $action ) { | |
// Get the form where this entry is from | |
$form = GFAPI::get_form( $entry['form_id'] ); | |
// Lets send a form notification with the action that has occured | |
GFAPI::send_notifications( $form, $entry, rgar( $action, 'type' ) ); | |
} | |
// Tells the notification to be sent only when this hook is found and to include the arguments ($entry and $action) | |
add_action( 'gform_post_payment_refunded', 'gfroms_after_payment_refunded', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment