Description
Use this filter to add alternative payment methods to the Card field.
Note that we recommend using the payment field specific to the payment type you are using, such as Stripe Card Field or PayPal Field. The Card Field is intended as an option for payment methods where no integrated payment field is available.
Usage
add_filter( 'gform_payment_methods', 'your_function_name', 10, 3 );
$payment_methods array
Array containing other loaded payment methods.
$field Field Object
The current field.
$form_id integer
The ID of the current form.
Examples
This example adds a payment method named Test Payment.
add_filter( 'gform_payment_methods', 'add_payment', 10, 3 );
function add_payment( $payment_methods, $field, $form_id ) {
$payment_methods[] = array(
'key' => 'testing',
'label' => 'Test Payment'
);
return $payment_methods;
}
Placement
This code should be placed in the functions.php file of your active theme. If you are creating a plugin to integrate with Gravity Forms, this filter would go in your plugin file.
Source Code
This filter is located in GF_Field_CreditCard::get_field_input() in includes/fields/class-gf-field-creditcard.php.