How to promote user after they update billing following a failed recurring

Using Authorize.NET and have setup monthly recurring billing via pro-forms. User Level3 and Level4 are paid subscriptions. This is working great.

When a user’s recurring billing fails (card expired, charge fails, etc) they are successfully demoted to Level0. This too is working good.

We have a Level0 ‘My Account’ page where they can login and go to update their billing info – using shortcode:

[s2Member-Pro-AuthNet-Form update="1" desc="Update your billing information." accept="visa,mastercard,amex,discover" default_country_code="US" captcha="0" /]

But after user has successfully submitted their updated billing information they remain at Level0.

How do we configure s2 to promote the user (immediately) following their updated billing ?

Thanks
Dan

You need to use a Billing Modification Form, not an Update Form.

Thanks Tim!

Any good way to identify if that user (who is now Level0) was originally Level3 or Level4 ?
…need to have an appropriate Billing Modification Form setup depending on the user’s previous Level, so they’re charged & recurring billing is configured to match their expectation (same account level and pricing).

I’m thinking of using ccap (“level3”, “level4”) to reference, but wondering if there’s a better way?

Thanks
Dan

You don’t need to know what they were before. s2Member will recognize who they are automatically if they are logged in.

Hmmm… I’m a bit confused, as you suggested to use Billing Modification Form, but that requires setting a level that modifies the user.

Modification Process: Very simple. A Member clicks a link to a special Post/Page, which contains a Modification Form you’ve generated. The Member fills in their billing information. After a successful form submission, s2Member will update the status of their account to the Level, pricing, and terms that you configure below. If the Member already has an existing paid Subscription with you, that paid Subscription will be cancelled automatically behind-the-scenes, and a new paid Subscription will be created to replace the old one. Again, the new paid Subscription is based on the Level, pricing, and terms that you specify below. If you need to give Customers some sort of grace period when/if they upgrade to a more expensive plan, please feel free to handle this through the application of free days, or with special pricing configured below.

Integrating Conditionals: Since each Modification Form is configured for a specific Level, you may want to create multiple Modification Forms, one for each combination you intend to make available…

And when generating the shortcode for Billing Modification Form it requires setting a Level.

How do I create/generate a Billing Modification Form to use the user’s existing (or previous) Level ?

Thanks

You set the level they will become, not the level they currently are.

In order to keep track of the user’s previous role (since they’ve been demoted to Level0 after recurring transaction failure) I am using ccap specific entry (“level3”, “level4”) as a reference.

I then setup s2If based on the user’s ccap to display the corresponding Billing Modification Form to maintain their previous role Level and pricing structure.

Thanks Tim for your help! :slight_smile:

Dan

That seems a very strange way to accomplish this. Why don’t you use usermeta instead?

I’m all ears! I am open to a better/more elegant solution…
What would I do / how to use usermeta ?

All you need to do is add a meta value to indicate what role a member has when it is assigned. Something like this:

function kts_s2member_role_usermeta( $user_id ) {
        add_user_meta( $user_id, 's2member_role', get_user_field( 's2member_access_role' ) );
}
add_action( 'set_user_role', 'kts_s2member_role_usermeta' );

That’s untested, but it should get you most of the way.

Thanks Tim,
That is robust, but a bit more complex and extensive from what I’ve implemented…

On the purchase ProForm I set the ccaps attribute with the corresponding role level they’re purchasing – so when a user registers and submits their initial payment it stores their level:

[s2Member-Pro-AuthNet-Form level="4" ccaps="level4"

If they’re demoted down to Level0 via transaction failure/credit card expiration, it’s as simple as checking their ccap for what their account was originally. Using s2If it displays the correct ProForm to either show Billing Modification Form, or Update Form:

[s2If current_user_can(access_s2member_ccap_level4) AND current_user_cannot(access_s2member_level4) AND current_user_can(access_s2member_level0) ]
	
	<!-- Level 4 user, but currently at Level 0 role - display Billing Modification ProForm -->
	[s2Member-Pro-AuthNet-Form modify="1" level="4" ccaps="level4" ...]
	
[/s2If]

[s2If current_user_can(access_s2member_ccap_level4) AND current_user_can(access_s2member_level4) ]

	<!-- Level 4 user, and at Level 4 role - display Billing Update ProForm -->
	[s2Member-Pro-AuthNet-Form update="1" desc=" " accept="visa,mastercard,amex,discover" default_country_code="US" captcha="0" /]
	
[/s2If]

Sorry, but unless you have modified the default settings, your shortcodes don’t do what you say they do. If someone can access s2Member level 4, then they can automatically access level 0. So your conditionals aren’t really doing anything.

Think you missed the content of the s2If

[s2If current_user_can(access_s2member_ccap_level4) AND current_user_cannot(access_s2member_level4) AND current_user_can(access_s2member_level0) ]

specifically the current_user_cannot statement

I think I was thrown by the fact you have both access_s2member_ccap_level4 and access_s2member_level4 – which is actually one of the reasons why I would never use ccaps like this. (One of the others is that you can’t easily sort lists of members this way, as you could if you used metadata.)