This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
Use this filter to adjust the attributes of the payment method types in Stripe.
Usage
add_filter('frm_stripe_payment_method_types', 'change_payment_method_type');
Parameters
- $payment_method_types
Examples
Add US Bank Account
add_filter('frm_stripe_payment_method_types', 'add_us_bank_account');
function add_us_bank_account( $payment_method_types ) {
$payment_method_types = array( 'card', 'link', 'us_bank_account' );
return $payment_method_types;
}
Add Euro payments
Use this code example to add support for SOFORT, iDEAL, and Bancontact one time payments when using euros. Note: Subscriptions are currently not supported.
add_filter('frm_stripe_payment_method_types', 'add_sofort_ideal_bancontact');
function add_sofort_ideal_bancontact( $payment_method_types ) {
$payment_method_types = array( 'sofort', 'ideal', 'bancontact' );
return $payment_method_types;
}
Add WeChat Pay
Use this code example where the only payment method type is WeChat Pay for a form with 5 as its ID.
add_filter('frm_stripe_payment_method_types', 'add_wechat_pay', 10, 2);
function add_wechat_pay( $payment_method_types, $args ) {
$form_id = $args['form_id'];
$target_form_id = 5; // Change 5 to the ID of your form
if ( $target_form_id === $form_id ) {
$payment_method_types[] = 'wechat_pay';
}
return $payment_method_types;
}
Filter payment method
Use this code example to map the form with ID 75 to use affirm as its only payment method and form ID 76 to use card, link, and klarna.
add_filter('frm_stripe_payment_method_types', 'filter_stripe_payment_method', 10, 2);
function filter_stripe_payment_method( $payment_method_types, $args ) {
$map = array(
75 => array( 'affirm' ),
76 => array( 'card', 'link', 'klarna' ),
);
$form_id = $args['form_id'];
if ( isset( $map[ $form_id ] ) ) {
$payment_method_types = $map[ $form_id ];
}
return $payment_method_types;
}