Skip to content

Instantly share code, notes, and snippets.

@New0
Created March 2, 2018 12:31
Show Gist options
  • Save New0/63efa2838a01577a6752b0a5cca871ce to your computer and use it in GitHub Desktop.
Save New0/63efa2838a01577a6752b0a5cca871ce to your computer and use it in GitHub Desktop.
Send email when Stripe payment with Caldera Forms failed after process
<?php
add_action( 'caldera_forms_redirect', function( $type, $url, $form ){
//Change the Form ID
if( $form['ID'] === 'CF5a5e8452c6f82' ) {
//Set the recipient the sbuject and the message
$recipient = '[email protected]';
$subject = 'My Email Subject';
$message = 'My Email content';
global $transdata;
$form['mailer']['recipients'] = $recipient;
$form['mailer']['email_subject'] = $subject;
$form['mailer']['email_message'] = $message;
if( $transdata['type'] === 'error' && $transdata['note'] === 'Your card was declined.' ) {
Caldera_Forms_Save_Final::do_mailer( $form, null, $transdata['data'] );
}
}
}, 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment