Description
Filter the Mollie payment methods.
Usage
add_filter( 'gform_mollie_payment_methods', 'your_function_name', 10, 1 );
Parameters
- $methods array
The payment methods.
Examples
Modify available payment methods.
add_filter( 'gform_mollie_payment_methods', 'filter_mollie_payment_methods', 10, 1 );
function filter_mollie_payment_methods( $methods ) {
// Allow only the Bank payment method as defined by Mollie's API.
$filtered_methods = array_filter( $methods, function( $method ) {
return $method['id'] === 'bancontact';
});
return $filtered_methods;
}
For more information about available payment methods, refer to this article.
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?
Since
Added in Mollie 1.0
Source Code
$methods = apply_filters( 'gform_mollie_payment_methods', $methods );
This hook is located in GF_Mollie::get_methods() in class-gf-mollie.php.