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.

[Update]: Central IPN + Shortcode buttons.

Home Forums Community Forum [Update]: Central IPN + Shortcode buttons.

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

Topic Author Topic
Posted: Tuesday Aug 6th, 2013 at 9:48 am #55285
Adam Tal
Username: baduist

I’m trying to set up the central IPN script to ping my 2 s2members websites as well as my invoicing software.

The problem is, pointing my Paypal account’s default IPN url to this script is gets ignored completely, as I’m using paypal buttons generated by s2member (using the shortcodes) which override the default IPN set in Paypal.

Am I missing something?

  • This topic was modified 3 years, 5 months ago by  Adam Tal.

List Of Topic Replies

Viewing 13 replies - 1 through 13 (of 13 total)
Author Replies
Author Replies
Posted: Wednesday Aug 7th, 2013 at 3:03 pm #55365
Adam Tal
Username: baduist

Updated. Bump.

Posted: Thursday Aug 8th, 2013 at 4:15 am #55391
Bruce
Username: Bruce
Staff Member

The problem is, pointing my Paypal account’s default IPN url to this script is gets ignored completely, as I’m using paypal buttons generated by s2member (using the shortcodes) which override the default IPN set in Paypal.

If you’re using buttons, then PayPal will allow you to override the IPN URL, effectively overriding the need for the central IPN script. The reason for the central IPN script is because PayPal does not make this possible with Pro Forms. I’m not sure why you need to accomplish this. Could you specify why that is, and maybe I can help you find a solution.

Posted: Thursday Aug 8th, 2013 at 6:44 am #55411
Adam Tal
Username: baduist

Thanks Bruce.

I need to hit 2 url’s:
1. s2member site(s)
2. My invoicing software.

When I create regular buttons for my landing pages that do not use s2member, it’s all good, I just set the notify_url parameter on the button to hit my multiple IPN script, which forwards the notification to my invoicing software, and to my custom CRM to log the purchase.

However, for my s2member sites, the problem is:
1. I can’t change notify_url on a per button basis, because the s2m shortcode doesn’t support it, and uses a default address for all buttons (http://mystie.com/?s2member_paypal_notify=1).

2. Changing the default IPN in my paypal account to a multiple IPN script does not help, because it is overridden by the s2member buttons which automatically use http://mystie.com/?s2member_paypal_notify=1 as the notify_url, and as I mentioned, I can’t change that.

To clarify: the address in paypal’s settings is never ever pinged/notified, because it gets overridden by s2member buttons. So I can’t figure out how to notify my invoicing software when there’s an s2member transaction.

Thanks :)

Adam

Posted: Friday Aug 9th, 2013 at 11:16 pm #55507
Bruce
Username: Bruce
Staff Member

Thanks for the clarification. Sorry about the delay.

Can you not set up s2Member to send information to your invoice software on each of your installations using API Notifications? That might be simpler for you.

See: Dashboard -› s2Member® -› API / Notifications -› Signup Notifications

s2Member doesn’t make it possible to change the notify_url paramter without editing the source code directly, which means that when you update s2Member, it will overwrite these changes. So I would suggest trying using the API Notifications first. If you cannot accomplish what you need to that way I can show you where to edit in the source code to change this.

Posted: Saturday Aug 10th, 2013 at 10:18 am #55523
Adam Tal
Username: baduist

I tried the “Payment notifications” to make sure that all payments are invoiced. It doesn’t seem to work.

My guess is that it’s is because the invoicing software expects IPN*, while the notification sent by s2member is in a different format or something.

Note that the invoicing software does appear to work with a multiple-IPN kind of script that I have for others sites (that are not based on s2member).

P.S.

* I’m not a big expert on IPN but I would assume there’s also and element of sending back data to paypal for authorisation/confirmation or something, right?

If I am right about this, would be cool to have a IPN forwarding option as another type of notification. I would assume it’s just pluging in the multiple IPN script into the plugin… (right?)

Posted: Monday Aug 12th, 2013 at 11:30 pm #55608
Bruce
Username: Bruce
Staff Member

I tried the “Payment notifications” to make sure that all payments are invoiced. It doesn’t seem to work.

My guess is that it’s is because the invoicing software expects IPN*, while the notification sent by s2member is in a different format or something.

I see. So you’ll need to edit the code, or use s2Member’s Pro Forms to accomplish this.

The line you’d want to edit in your installations is line 233 in this file:

/s2member/includes/classes/sc-paypal-button-in.inc.php

You’d replace this portion of the line:

site_url ("/?s2member_paypal_notify=1")

With your IPN URL. If you want to keep s2Member from overwriting these changes in the future, you can copy this file, make that change and put it into a Must-Use Plugin.

See: http://codex.wordpress.org/Must_Use_Plugins

Sorry for the inconvenience. I will see if it’s possible to make this easier in the future.

Posted: Tuesday Aug 13th, 2013 at 3:31 am #55616
Adam Tal
Username: baduist

Thanks for the help Bruce!

I must say, it’s pretty awesome how you guys come up with solutions for anything that comes up, one of the reasons I stick to s2member.

Would be awesome if you could add this to the next update so other people can enjoy this as well, perhaps just adding an input that allows the user to define a separate address for IPN (maybe the url of your multiple IPN script).

Posted: Tuesday Aug 13th, 2013 at 3:33 am #55617
Adam Tal
Username: baduist

Quick question about implementing your solution:

If I just copy sc-paypal-button-in.inc.php into the mu-plugins folder will it override the original file in the s2member plugin folder? Or is there anything else I need to do for it to work?

Thanks!

Posted: Tuesday Aug 13th, 2013 at 3:39 am #55618
Bruce
Username: Bruce
Staff Member

If I just copy sc-paypal-button-in.inc.php into the mu-plugins folder will it override the original file in the s2member plugin folder? Or is there anything else I need to do for it to work?

Yeah this will work. It’s because, if you look near the top of the file, s2Member looks to see if the class that’s created in this file already exists:

if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_in"))

This check is also applied before the file is even loaded, so as long as you’re not editing the class name on in the file (or any of s2Member’s files that runs the class_exists() check), the file will overwrite the s2Member file.

You will want to keep an eye out and make sure that if we do perform any changes to this file that you get around to updating your edited file. I am looking to see if it’s possible to add a way to achieve this without overwriting the whole file before the next release. If we do end up making this possible more simply I’ll let you know here. :-)

Posted: Tuesday Aug 13th, 2013 at 3:51 am #55621
Adam Tal
Username: baduist

Cool thanks!

And in my multiple IPN script I’m gonna use mysite.com/?s2member_paypal_notify=1 right?

Posted: Tuesday Aug 13th, 2013 at 3:54 am #55622
Bruce
Username: Bruce
Staff Member

And in my multiple IPN script I’m gonna use mysite.com/?s2member_paypal_notify=1 right?

It should just be the same URL as you have set up at PayPal. If you’re using the central IPN processor, this URL should be set to go directly to the file where you have it uploaded to your server. Probably something like this:

http://yoursite.com/paypal-central-ipn.php
Posted: Tuesday Aug 13th, 2013 at 3:56 am #55623
Adam Tal
Username: baduist

yeah I meant, in paypal-central-ipn.php – I’ll have
1. IPN listener URL of my invoicing software
2. IPN listener of s2m -> mysite.com/?s2member_paypal_notify=1

right?

Posted: Tuesday Aug 13th, 2013 at 4:01 am #55624
Bruce
Username: Bruce
Staff Member

yeah I meant, in paypal-central-ipn.php – I’ll have
1. IPN listener URL of my invoicing software
2. IPN listener of s2m -> mysite.com/?s2member_paypal_notify=1

Sorry about that.

I’m not sure where you’d put the URL to your invoicing software. You would probably need to edit the file somewhere near line 60, which I can’t help with. You might try using the curlpsr function that the file creates to open another connection to your invoicing software. Past that goes beyond what I’m allowed to due according to our Support Policy.

As far as the top of the file where it says this:

$config = /* One line for each domain (follow the examples here please). */ array
	(
		"[YOUR DOMAIN]" => "[FULL URL TO AN IPN HANDLER FOR YOUR DOMAIN]",
		"www.site1.com" => "http://www.site1.com/?s2member_paypal_notify=1",
		"www.site2.com" => "http://www.site2.com/?s2member_paypal_notify=1",
	);
/*

The first part is the custom attribute, or your site’s home URL essentially. The other is the IPN URL for that site that you’d find here:

Dashboard -› s2Member® -› PayPal® Options -› PayPal® IPN Integration

Viewing 13 replies - 1 through 13 (of 13 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.