Depending on your membership site’s business model, you may want to charge members an additional fee based on the payment gateway. This approach can ensure that transaction fees don’t cut into profits. This article will explore three methods to adjust the membership pricing at checkout based on payment gateway.

The methods inlcude the following:

  • Adding a Fixed Fee
  • Adding a Percentage % Fee
  • Adding a Fee by Level
Three Methods to Adjust Membership Pricing Based on Payment Gateway

Method 1: Adding a Fixed Fee

<?php
/**
* This recipe will add a fee to the initial and recurring value when using Stripe
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_checkout_level( $level ){
if( !empty( $_REQUEST['gateway'] ) ){
if( $_REQUEST['gateway'] == 'stripe' ){
$level->initial_payment = $level->initial_payment + 3; //Updates initial payment value
$level->billing_amount = $level->billing_amount + 3; //Updates recurring payment value
}
}
return $level;
}
add_filter( "pmpro_checkout_level", "my_pmpro_checkout_level" );

Method 2: Adding a Percentage Fee

<?php
/**
* This recipe will add a percentage based fee to the initial and recurring value when using Stripe
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_increase_level_cost_by_percentage_for_gateway( $level ) {
// set your percentage here
$percentage = 4; // e.g. 4 = 4% increase
// Bail if percentage is not valid.
if ( ! is_numeric( $percentage ) || $percentage <= 0 ) {
return $level;
}
$percentage = $percentage / 100; // convert to decimal
$increased_initial_payment = $level->initial_payment + ( $level->initial_payment * $percentage ); // calculate the increased initial payment
$increased_recurring_payment = $level->billing_amount + ( $level->billing_amount * $percentage ); // calculate the increased recurring payment
if ( ! empty( $_REQUEST['gateway'] ) && $_REQUEST['gateway'] == 'stripe' ) {
$level->initial_payment = $increased_initial_payment; //Updates initial payment value
$level->billing_amount = $increased_recurring_payment; //Updates recurring payment value
}
return $level;
}
add_filter( 'pmpro_checkout_level', 'my_pmpro_increase_level_cost_by_percentage_for_gateway' );

Method 3: Adding a Fee to a Specific Membership Level

<?php
/**
* This recipe will add a fee to the initial and recurring value for specific levels when using Stripe
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_checkout_level( $level ){
if( !empty( $_REQUEST['gateway'] ) ){
if( $_REQUEST['gateway'] == 'stripe' ){
if( !empty( $_REQUEST['level'] ) ){
if( in_array( $_REQUEST['level'], array( 1, 2, 3 ) ) ){
$level->initial_payment = $level->initial_payment + 3; //Updates initial payment value
$level->billing_amount = $level->billing_amount + 3; //Updates recurring payment value
}
}
}
}
return $level;
}
add_filter( "pmpro_checkout_level", "my_pmpro_checkout_level" );

Adding the Recipe to Your Website

You can add this recipe to your site by creating a custom plugin or using the Code Snippets plugin available for free in the WordPress repository. Read this companion article for step-by-step directions on either method.

These recipes will need to be customized for your specific gateway check, fee, and level IDs. Please open a ticket in the private support area for more help using these methods.


Free Course: Membership Site Development—The Basics

Develop a deeper understanding of membership site development in this beginner-level course. Learn how to make your site work better, save yourself time and money, and improve your site's performance.

Featured Image for Membership Site Development Course: The Basics


Was this article helpful?
YesNo