Support » Plugin: Direct Stripe » Modify user and admin email content after successful payment

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi,
    I managed to create an add-on. as below:
    *********** code below *********************
    <?php

    /*
    * Plugin Name: Cirect Stripe Success Email
    * Description: Cirect Stripe Success Email Content
    * Author: nahuel
    * Author URI: https://newo.me/
    * Version: 0.0.1
    */

    add_filter( ‘direct_stripe_success_user_email_content’, function( $message, $token, $amount, $currency, $email_address, $description, $user_id, $button_id){

    $message = ‘User ‘ . $email_address . ‘ have been charged ‘ . $amount . $currency . ‘ for ‘ . $description;

    return $message;

    }, 10, 8 );

    add_filter( ‘direct_stripe_success_admin_email_content’, function( $token, $amount, $currency, $email_address, $description, $user_id, $button_id, $message){
    $today = date(“j, n, Y”);

    $user_info = get_user_by(’email’, $email_address);
    $user_email = $user_info->user_email;

    $message = ‘<h1>TEXT – somesite.ru</h1><br/>’ .
    http://{$_SERVER[‘HTTP_HOST’]}<br/>” .
    ‘TEXT – ‘ . $email_address . ‘<br/>’ .
    ‘TEXT- ‘ . number_format( $amount/100, 2) .’   ‘. $currency . ‘<br/>’ .
    ‘TEXT – ‘. $description . ‘<br/>’ .
    ‘TEXT – ‘ . $today . ‘<br/>’ .
    ‘TEXT – ‘ . print_r($user_info) . ‘<br/>’;

    $message .= ‘User – ‘ . $user_email . ‘<br/>’;

    return $message;

    }, 10, 8 );

    *********** code above *********************

    But now with that activated, I don’t receive user or admin emails.
    Thanks in advance.

    Plugin Author Nicolas Figueira

    (@nahuelmahe)

    Hello @ankit2694 ,

    Thank you for using Direct Stripe.

    The code example had multiple issues ( quotes format, concatenation, filter parameters ). You will find your example edited at https://gist.github.com/New0/ffeb19410601e952d368aba3dbdf4674

    Let me know if that helped.

    Best regards,

    ankit2694

    (@ankit2694)

    Hi Nico,
    Thanks very much for your reply and the code cleanup. It works like a charm for emails. But now the payment screen gets stuck. Following your forum, https://wordpress.org/support/topic/payment-stuck-processing/ and https://wordpress.org/support/topic/stuck-in-processing/ I deleted users from WordPress and also on Stripe. The payment gets through, but payment screen freezes. All my stripe logs are ‘200 OK’ (https://photos.app.goo.gl/VH8XvfcHbUXyWtGk6).
    Thanks in advance.

    ankit2694

    (@ankit2694)

    Just to add. I’m using the DS for payment (and not for Subscription). Here is the event log of another payment, https://photos.app.goo.gl/F5RexCzNsfXm2SKt7, which got stuck as well.
    I tried a random email, the payment got through ‘200 OK’ and a failed mail delivery, which was expected.
    Thanks in advance,
    Ankit

    • This reply was modified 7 months ago by ankit2694.
    ankit2694

    (@ankit2694)

    Hi Nico,
    An update. The failed page redirection is not working with the filter email add-on activated. With it is deactivated, all working fine. I will continue testing and update you in case of any breakthrough. But if you have any pointer, please let me know. Thanks in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Modify user and admin email content after successful payment’ is closed to new replies.