latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Conditional for current user payment gateway?

Home Forums Community Forum Conditional for current user payment gateway?

This topic contains 4 replies, has 2 voices. Last updated by  Renata Murez 3 years, 4 months ago.

Topic Author Topic
Posted: Thursday Aug 15th, 2013 at 1:31 am #55812

Hello!
I couldn’t find any shortcode conditional to check what payment gateway the current user is using for his subscription.
I’m setting up my installation of s2Member pro and ‘m planning to use two different gateways on my website (Paypal Pro forms AND Authorize.net Pro forms) so i will offer my customers the possibility to pay using credit cards through Authorize.net or via Paypal Express Checkout. You understand of course that i do not want them paying via paypal with a credit card… Until here everything is fine and not a problem to do.

It gets complicated here: i want to be able to display my cancel forms and my downgrade/upgrade forms to the customer on the Login Welcome Page according to the correct payment gateway he used when he subscribed… So I DO NOT WANT TO HAVE TO FORCE THE CUSTOMER TO CHOOSE BETWEEN: “Cancel via Paypal” or “Cancel via Authorize.net” for example… I want to display only the correct Cancel Form dynamically according to the current user payment gateway. You probably have a solution for that guys :) I can not stop using authorize.net because i’m having very special low rates with them comparing to Paypal…

Thanks for your help.

List Of Topic Replies

Viewing 4 replies - 1 through 4 (of 4 total)
Author Replies
Author Replies
Posted: Thursday Aug 15th, 2013 at 5:31 pm #55914

Here is the solution i came with so far…
For example if i offer only one recurring billing subscription (“Unlimited access to videos” for example), i’m assigning a Level#1 access to a subscriber who paid via Paypal and a Level#2 access to a subscriber who paid via Authorize.net, then using “User Role Editor” plugin, i allow Level#1 and Level#2 subscribers to access each other’s Level. This way, i can display the appropriate Cancel button to each subscriber using the conditional [s2If current_user_is(s2member_level1)]Cancel button for Authorize.net Subscriber[/s2If][s2If current_user_is(s2member_level2)]cancel button for Paypal Subscriber[/s2If]
This solution should work but i’ll need to increase the number of allowed levels and it can get complicated to setup if we offer many subscription types…

Any “MORE ELEGANT” solution guys???

Thanks :)

Posted: Thursday Aug 15th, 2013 at 7:42 pm #55923
Moderator

s2Member® stores this inside a user option value in the DB (s2member_subscr_gateway).

So you can do something like this in PHP code. Not sure how you might choose to integrate this with Simple Shortcodes, but hopefully this will send you in the right direction.

<?php
if(get_user_option('s2member_subscr_gateway') === 'paypal')
	// do something for PayPal.

else if(get_user_option('s2member_subscr_gateway') === 'authnet')
	// do something for Authorize.Net.
?>
Posted: Thursday Aug 15th, 2013 at 7:42 pm #55924
Moderator
Posted: Friday Aug 16th, 2013 at 1:41 pm #56045

Mike,
This is exactly what i was looking for!
I tested it and IT’S WORKING PERFECTLY.
THANK YOU!

Viewing 4 replies - 1 through 4 (of 4 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.