Redirect not working when level="*"

I am planning to sell a custom capability independent of member level. Following the instructions in s2Member Pro>Paypal Pro Forms>Shortcode Attributes, I set level="*" so when the new custom capability is applied, the existing user level remains unaffected.

Is this a known bug or am I missing something? Has anyone discovered a solution to this?

My shortcode is as follows:
[s2Member-Pro-PayPal-Form level="*" ccaps=“test” desc=“Test description” ps=“paypal” lc="" cc=“USD” dg=“0” ns=“1” custom=“127.0.0.1” ra=“0.01” rp=“1” rt=“L” rr=“BN” accept=“paypal” accept_via_paypal=“paypal” coupon="" accept_coupons=“0” default_country_code="" captcha=“0” success="/thank-you" /]

Have you set a Membership Options Page? How have you tested, and using what role and level? What exactly happens?

I see you test it at your local computer, this may not works, depends of several different settings and used package. Better try it online, and use tiny sum, instead Paypal sandbox.

I’ve actually had pretty good success with the Paypal sandbox in its latest form and can do just about everything in a local install. This project is finally just about ready to go on a test site online for more testing before going live.

I searched a bit more and found out that custom capabilities and the success="" parameter don’t mix as success only fires when the transaction is related to a new member. I had to do

I ultimately did the following which works…though may not be the best way of handling this:

In s2Member API/Notifications>Payment Notifications, I added the following which is in the url from what paypal returns:
http://127.0.0.1/coa101307/my-page/?s2member_paypal_xco=s2member_pro_paypal_checkout_return

I have a separate php file located in the mu-plugins folder that has the following check:
add_filter(‘ws_plugin__s2member_pro_paypal_checkout_post_attr’, function ($attr) {
if (!empty($_GET[‘s2member_paypal_xco’]) && $_GET[‘s2member_paypal_xco’] === ‘s2member_pro_paypal_checkout_return’) {

Then inside the if function I have the following redirect code (in addition to some other stuff)

$redirect_url = get_site_url() . ‘/my-thank-you-page/’;
wp_redirect($redirect_url);
exit;

This actually circumvents the confirmation s2Member will send to the purchaser, but that is ok as I was going to have to do this anyway for a custom function.

Thanks for the explanation and code!

As a follow up to this for the community, the exit; command was not necessary and was actually causing problems with Paypal. Remove it and the code works great in a live environment.

Cheers!