• Resolved Yordan Milenkov

    (@komapa)


    Hello,

    Is there an action hook for the DISPUTE_OPENED webhook request?

    I need to change the status of the subscription to wc_onhold.

    Thank you in advance!
    Best regards!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Payment Plugins

    (@mrclayton)

    Hi @komapa

    Yes, you can use the action 'wc_braintree_webhook_notification_' . $notification->kind to process any webhook.

    https://docs.paymentplugins.com/wc-braintree/api/source-class-WC_Braintree_Controller_Webhook.html#134

    Kind Regards

    Thread Starter Yordan Milenkov

    (@komapa)

    Sorry for the delay!

    I’m trying to put a new hook in my php file in plugins directory, but either nothing happens or the whole site breaks.

    I try things like:

    add_action( 'wc_braintree_webhook_notification_CHECK' , 'my_function', 10, 1 );
    
    function my_function($request){
    file_put_contents('./log_wc_braintree_webhook_notification_check_'.date("j.n.Y").'.log', 'wc_braintree_webhook_notification_check: '.json_encode($request).PHP_EOL, FILE_APPEND);
    }

    Please, provide some examples!

    Regards!

    Thread Starter Yordan Milenkov

    (@komapa)

    if(isset($notification)){
    	add_action( 'wc_braintree_webhook_notification_' . $notification->kind, 'my_mybraintree_webhook_notification_handler', 10, 2);
    }
    
    function my_mybraintree_webhook_notification_handler( $notification, $request ) {	
    	file_put_contents('./log_my_braintree_webhook_notification_handler_'.date("j.n.Y").'.log', 'my_braintree_webhook_notification_handler $request: '.json_encode($request).PHP_EOL, FILE_APPEND);
    	file_put_contents('./log_my_braintree_webhook_notification_handler_'.date("j.n.Y").'.log', 'my_braintree_webhook_notification_handler $notification: '.json_encode($notification).PHP_EOL, FILE_APPEND);
    
    }

    Or like this.

    No any log…

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘do_action on Dispute’ is closed to new replies.