Using Gravity Forms ‘gform_stripe_checkout_supported_cards’ PHP filter

The gform_stripe_checkout_supported_cards Gravity Forms PHP filter was used to modify the list of supported credit cards for the Stripe Checkout. However, this filter has been removed in Stripe version 3.0.

Usage

add_filter('gform_stripe_checkout_supported_cards', 'customize_supported_cards');
function customize_supported_cards($supported_cards) {
  // your custom code here
  return $supported_cards;
}

Parameters

  • $supported_cards (array): An array of supported credit card types.

More information

See Gravity Forms Docs: gform_stripe_checkout_supported_cards

Important: This filter was removed in Stripe version 3.0. With the new version of Stripe Checkout, the supported cards can no longer be modified.

Examples

Remove American Express from the list of supported cards

To remove American Express from the list of supported cards, you can use the following code:

add_filter('gform_stripe_checkout_supported_cards', 'remove_amex_from_supported_cards');
function remove_amex_from_supported_cards($supported_cards) {
  // Remove 'amex' from the supported cards array
  $supported_cards = array_diff($supported_cards, array('amex'));
  return $supported_cards;
}

Add Diners Club to the list of supported cards

To add Diners Club to the list of supported cards, you can use the following code:

add_filter('gform_stripe_checkout_supported_cards', 'add_diners_club_to_supported_cards');
function add_diners_club_to_supported_cards($supported_cards) {
  // Add 'diners' to the supported cards array
  array_push($supported_cards, 'diners');
  return $supported_cards;
}

Note: The gform_stripe_checkout_supported_cards filter has been removed in Stripe version 3.0, and these examples will not work with Stripe version 3.0 or later.