Tips and Tricks HQ Support Portal › Forums › WP Affiliate Platform › Step by Step Instructions for s2member integration?
Tagged: s2member, third party integration, WP Affiliate
- This topic has 21 replies, 3 voices, and was last updated 14 years, 1 month ago by amin007.
-
AuthorPosts
-
October 18, 2010 at 6:11 pm #2058chelleMember
I saw the post regarding integrating with s2member here:
https://support.tipsandtricks-hq.com/forums/topic/integration-with-s2member-plugin
But I am still confused as to what exactly to do. I have tried entering the IPN handling address in the notifications section and placing my phpcode in the custom field value for the button as per the plain button directions in the documentation, but with my test transaction no sale was recorded in my affiliate control panel.
Do I need to enable remote post? What exactly needs to be copied and pasted where?
Can someone point me in the right direction with step by step instructions? I am struggling!
Thanks in advance for the help!
October 19, 2010 at 1:03 am #25568amin007ParticipantPlease post a link to the page where you have your payment button. Most likely the payment button is missing the code to include the cookie value in the “Custom” field.
October 19, 2010 at 3:42 am #25569chelleMemberThanks for the quick reply!
Here is the sign up link:
[http://scrapvine.com/sign-up-now]
And here is my button code I have hardcoded into my theme:
</p>
<p><form action="https://www.paypal.com/cgi-bin/webscr" method="post"><br />
<input type="hidden" name="business" value="mypaypalemail@email.com" /><br />
<input type="hidden" name="cmd" value="_xclick-subscriptions" /><br />
<!-- Instant Payment Notification & Return Page Details --><br />
<input type="hidden" name="notify_url" value="http://www.scrapvine.com/?s2member_paypal_notify=1" /><br />
<input type="hidden" name="cancel_return" value="http://www.scrapvine.com" /><br />
<input type="hidden" name="return" value="http://www.scrapvine.com/?s2member_paypal_return=1" /><br />
<input type="hidden" name="rm" value="2" /><br />
<!-- Configures All Of The Checkout Fields --><br />
<input type="hidden" name="no_shipping" value="1" /><br />
<input type="hidden" name="no_note" value="1" /><br />
<input type="hidden" name="custom" value="www.scrapvine.com"|<?php echo $_COOKIE['ap_id']; ?> /><br />
<input type="hidden" name="currency_code" value="USD" /><br />
<input type="hidden" name="page_style" value="paypal" /><br />
<input type="hidden" name="item_name" value="Monthly" /><br />
<input type="hidden" name="item_number" value="1" /><br />
<!-- Identifies/Updates An Existing Member After Checkout --><br />
<input type="hidden" name="on0" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0; ?>" /><br />
<input type="hidden" name="os0" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0; ?>" /><br />
<input type="hidden" name="modify" value="0" /><br />
<!-- Customizes Prices, Payments & Billing Cycle --><br />
<!--<input type="hidden" name="amount" value="6.95" />--><br />
<input type="hidden" name="src" value="1" /><br />
<input type="hidden" name="sra" value="1" /><br />
<!--<input type="hidden" name="a1" value="0" />--><br />
<!--<input type="hidden" name="p1" value="0" />--><br />
<!--<input type="hidden" name="t1" value="D" />--><br />
<input type="hidden" name="a3" value="6.95" /><br />
<input type="hidden" name="p3" value="1" /><br />
<input type="hidden" name="t3" value="M" /><br />
<!-- Displays The PayPal Image Button --><br />
<input type="image" alt="PayPal" style="border:0;" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" /><br />
</form></p>
<p>Here is what I have set for my ipn url under payment notification urls in s2member:
[http://www.scrapvine.com/wp-content/plugins/wp-affiliate-platform/api/ipn_handler.php]
If I look at the page source, my affiliate ID is there in the pagesource where the phpcode would be, and it was also there on the computer my hubby used when he signed up through paypal. Cleared my cookies, and it was blank, so I can only hope that means it is working?
I’ve read the documentation about using the http get or post, and was not sure if I should enable that in the options settings and place that code in the button also or if it should just work like this?
I appreciate the help!
October 19, 2010 at 6:23 am #25570amin007ParticipantThank you for the details.. here is the issue:
<input type="hidden" name="custom" value="www.scrapvine.com"|<?php echo $_COOKIE['ap_id']; ?> />
Any particular reason for adding the site URL in the value parameter of the “custom” field?
If you look at the instruction you will see it tells you to use the following:
<input type="hidden" name="custom" value="<?php echo $_COOKIE['ap_id']; ?>">
Can you see the difference now?
October 19, 2010 at 3:47 pm #25571chelleMembers2member uses the custom field already, so in the notes where I entered the payment notification url there are directions that say to do this:
Custom Replacement Codes can also be inserted using these instructions:
* %%cv0%% = The domain of your site, which is passed through the
custom
attribute in your Shortcode.* %%cv1%% = If you need to track additional custom variables, you can pipe delimit them into the
custom
attribute, inside your Shortcode, like this: custom=”scrapvine.com|cv1|cv2|cv3″. You can have an unlimited number of custom variables that track IP addresses, affiliate IDs, etc. In some cases you may need to use PHP code to insert a value into the custom field dynamically. Obviously this is for advanced webmasters, but the functionality has been made available for those who need it.This example uses cv1 to track a User’s IP address:
( The IP address could be referenced using %%cv1%% )
custom=”scrapvine.com|<?php echo $_SERVER[“REMOTE_ADDR”]; ?>”
So that is why I did it that way. Should I have two custom fields defined instead?
I am so confused by all of this, lol. Thanks again!
October 19, 2010 at 3:54 pm #25572chelleMemberJust realized maybe my quotation marks are in the wrong place…going to try that and will report back
October 19, 2010 at 10:24 pm #25573chelleMemberYes! My quotations were off/wrong (took a few tries,lol) it is working now! Make sure you do not have smart quotes if copying/pasting and that you are careful with spaces.
So, if someone wants step by step instructions on integrating with s2member:
1. Paste the ipn notification handler under payment notification urls
http://www.your-domain-name.com/wp-content/plugins/wp-affiliate-platform/api/ipn_handler.php
2. Edit the code in the button to look like this:
<input type="hidden" name="custom" value="www.your-domainame.com|<?php echo $_COOKIE; ?>" />
Thanks for the help again Amin, the help/support here is much appreciated!
October 20, 2010 at 12:53 am #25574amin007ParticipantThank you for the summary. I have added this to the documentation site:
October 21, 2010 at 6:24 am #25575chelleMemberWell, it was working in Sandbox mode quite nicely yesterday…but since trying 3 live test transactions (all done on different computers with different paypal addresses) none of them have shown as sales and now back in sandbox I am not seeing any sales either. Would there be another method to try?
October 21, 2010 at 11:41 pm #25576amin007ParticipantI am actually a bit surprised that it worked the first time because the value of the “custom” field. The affiliate plugin’s IPN handler is only looking for the cookie value in the “custom” field (not the site URL and the cookie value).
So my question to you is..
Does the s2Member needs the site URL in the custom field to work or is this something you just added because their example says so?
October 22, 2010 at 2:56 pm #25577chelleMemberYes, the s2member plugin requires the domain for the custom value unfortunately – otherwise you get an error message saying it has to be that way when you try completing the transaction in sandbox.
I sent my question over to s2member to see if they had any insight – here is what they wrote:
It sounds like the problem is in how you’re notifying the IPN script provided by your affiliate system. s2Member’s Payment Notifications are not the same thing as an IPN notification, so your affiliate system is not getting data in the form it expects. I would suggest looking back over s2Member’s Payment Notifications and then write yourself a simple script that can receive the Payment Notification from s2Member and talk to your affiliate system through it’s HTTP POST method.
So I think I can paste this link under Payment Notification Urls:
With s2member, I can replace “ZZ” with their custom replacement value %%amount&& and then use the secret key from the wp-affiliate options panel, but not sure how to define ap_id this way. This is probably what they were talking about needing to write a custom script to link to instead, but I’m not sure the best way of going about that yet.
Will update if I figure anything out – I appreciate your help!
October 23, 2010 at 1:08 am #25578amin007ParticipantI think the easiest option will be to write another middle script that takes the s2Member’s notification and feeds it to the Affiliate Platform.
Is there a s2Member documentation page that shows what data they pass to the notification URL?
October 24, 2010 at 1:10 pm #25579chelleMemberThere is this video that explains it sort of:
October 25, 2010 at 4:31 am #25580amin007ParticipantThank you for that… so looks like with the current setup of the button you will only need to use the following in the Notifications URL:
Don’t forget to replace “XX” with the actual secret code and “example” with your own site URL.
Let me know how that goes.
October 25, 2010 at 4:35 pm #25581chelleMemberIt worked! I could hug you right now!
Here is a recap of the step by step instructions for future reference if anyone else ever wants to try this:
1. In WP Affiliate Platform settings, scroll to bottom for “Additional Integration Options” and check the box next to Enable Remote POST
2. In s2member options, under Paypal buttons, generate a button code and copy the long code (not the short code) and paste it into a theme template file. (You must have phpexec in order to paste it into a normal wordpress post or page, but it will work if you put it directly in your theme’s template file)
3. Edit the code in the button for the custom field. It will look something like this:
<input type="hidden" name="custom" value="www.example.com" />
You will want to replace it with this:
<input type="hidden" name="custom" value="www.example.com|<?php echo $_COOKIE; ?>" />
4. Go to s2member’s options ->API Notifications. Under “Payment Notification Urls” paste this link into the the box:
Be sure to replace “example.com” with your domain and the value “XX” with the secret code generated when you completed Step 1.
Thank you again so much for all of the help, I really appreciate it Hopefully I will not need to bother you again for awhile
-
AuthorPosts
- You must be logged in to reply to this topic.