plugins – Woocommerce if use a specific gateway, then set the value

Question

I want to add a filter or an action for the plugin, the purpose is to set the value to “0” if the order used “myCRED” gateway.

I found those 2 related filters of the plugin,

uap_filter_referral_amount
uap_public_filter_on_referral_insert_amount_value


actually, I am not sure which one should I use, but I tried both of the 2 filters, when checkout it shows internal error, I think the code may have some error, any one can help?

Here is the code I have tried:

function exclude_mycred_gateway( $order ){$payment_title = $order->get_payment_method_title(); if ($payment_title ) {
\$payment_title == "myCRED";
return "0";
}
}