After successful payment return url is not 'picked up'

I have a free registration but we sell ‘capabilities’. The code below is what I use in a foreach to loop through the available packages we have.

echo do_shortcode( '[s2Member-PayPal-Button level="*" ccaps="country_' . $package[ 'country_code' ] . '" desc="' . $package[ 'country_name' ] . ' package" ps="paypal" lc="" cc="EUR" dg="0" ns="1" custom="' . $domain . '" ra="' . $package[ 'price' ] . '.00" rp="1" rt="L" rr="BN" image="default" output="button" success="' . home_url() . '/thank-you/" /]' );

Even though success="" is defined, it does not get picked-up after a successful payment.

After every successful payment the return url = http://www.domain.com/?s2member_paypal_return=1&s2member_paypal_return_success=http%3A%2F%2Fwww.domain.com%2Fthank-you%2F.

That leads to this default grey page informing the user he now has capability X and he needs to login again. I can’t seem to get around this page.

I don’t understand. You have specified success to be your thank you page at the end of your shortcode. So it is doing exactly what you are asking it to do.

No it is not :slight_smile:

I am not getting forward to the thank you page, but to the URL listed above, which maybe should forward me to the thank you page, but it does not. Instead I see this.

OK, so silly question: do that page and URL exist? I am guessing they do, but that’s obviously the first thing to check.

Yes it does exist. It’s a default page, without the use of a page template.

OK, well, two things come to mind:

  1. Have you tried using the actual URL rather than building it from home_url()? I don’t see why it would make a difference, but I’d try it anyway.

  2. Are you using this to do billing modifications? If so, it won’t work. The instructions say of the success attribute:

Note, s2Member will NOT use this value if an existing account holder is being modified. s2Member handles account updates (i.e., billing modification) in a more dynamic way. Your Success Return URL is only applied to (new) Customers.

  1. Because this was done with various environments in mind.
  2. That might be the cause then. The payment is made to add a user capability.

Am I correct to assume I should use the Auto-Return Page template, listed under Paypal options > PDT/Auto return integration ? Because the preview link there does indeed show what I am seeing (albeit with some other values).

Although I did expect to be able to bypass it, as is explained in the PDT info.

It is also possible to bypass s2Member’s Auto-Return system altogether, if you prefer. For further details, please read more about the success="" Shortcode Attribute for PayPal Buttons generated by s2Member. You will find details on this inside your Dashboard, under: s2Member → PayPal Buttons → Shortcode Attributes (Explained). Please note: you will still need to configure your PayPal account for Auto-Return/PDT (as instructed above). Then, you may use the success="" Attribute in your Shortcode, when/if you need it. In other words, if you use the success="" Attribute in your Shortcode, the initial redirection back to s2Member’s default Auto-Return/PDT handler must still occur. However, instead of s2Member displaying an Auto-Return Template to the Customer, s2Member will silently redirect the Customer to the URL that you specified in the success=“http://…” Attribute of your Shortcode, allowing you to take complete control over what happens next.

I have achieved what I wanted, albeit a bit different. I made use of the paypal-return.php template. I copied that to my theme and edited so it looks like the rest of the theme. Now all I need to do is maybe tweak it a bit but now it does what I want it to do.