Page 2 of 4

Re: Using paypal created buttons

PostPosted: August 26th, 2010, 10:44 am
by drsolution
Hi
I have been following this VERY INTERESTING and thorough discussion and I thank Jason who must spend a good deal of time answering questions, for his effort and knowledge!

I have read where one can actually change the code to make a paid trial button but this is not the recommended way and that one can use a Paypal made button but must change/add item# etc. But (always is right ? LOL)
How is this done if the button code is encrypted ? Or did I miss another message somewhere?
Thanks
Sherwood

Re: Using paypal created buttons

PostPosted: August 30th, 2010, 2:48 pm
by Jason Caldwell
Hi Sherwood. Great to hear this. You are VERY welcome!
drsolution wrote:I have been following this VERY INTERESTING and thorough discussion and I thank Jason who must spend a good deal of time answering questions, for his effort and knowledge!

Yes, I've seen that this particular thread is receiving a LOT of attention. Stay tuned, I'll be doing a video tutorial on this topic shortly to discuss these topics in greater detail.

This thread will be updated once the video is completed.

Re: Using paypal created buttons

PostPosted: July 9th, 2011, 2:15 pm
by PseudoNyhm
... one year later ... Still a very useful post.

Notice that s2Member's built-in button generator works exceptionally well. The reason I am using PayPal saved buttons is to prevent fraud. With generated buttons, many fields such as price, could be manipulated by the user. Encrypted buttons are another attempt to thwart fraud, but I have yet to get those to work (in Sandbox).

I've been setting up a PayPal saved subscription button, and there are a couple differences from what I saw in this thread:

  • PayPal appears to (inconsistently) call "Item ID" a "Subscription ID" (I enter the value 1 so s2Member knows I'm upselling to level 1).
  • In the Advanced field, I add
    • notify_url=http://mydomain.com/?s2member_paypal_notify=1
    • custom=mydomain.com
    • modify=1

The modify=1 is because I have pre-registration (free Level 0), which modifies up to Level 1 with paid subscription.

At this point, s2Member will not know who this payment is for when the IPN comes in. I must add additional dynamic fields to the button code on my site. It appears that PayPal will accept these additional fields along with the pre-configured saved settings of the referenced button:

Code: Select all
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="WXYZABCDE">
<input type="hidden" name="on0" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0; ?>" />
<input type="hidden" name="os0" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0; ?>" />
<input type="hidden" name="on1" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1; ?>" />
<input type="hidden" name="os1" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1; ?>" />
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_subscribe_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>


Looking at s2Member-generated button code, I see a lot of other fields, but they appear to all relate to the pricing and such (things saved at PayPal for this referenced button).

Can anyone confirm that these four S2MEMBER_ variables are all that s2Member needs to properly track the transaction?

Re: Using paypal created buttons

PostPosted: July 9th, 2011, 4:31 pm
by Jason Caldwell
PseudoNyhm wrote:Can anyone confirm that these four S2MEMBER_ variables are all that s2Member needs to properly track the transaction?

Yes, those variables should be all you need. s2Member uses ON0 and OS0 to identify/update an existing account. Actually, with PayPal Standard Subscription "modifications", PayPal will send s2Member a "subscr_modify" IPN; so in many cases, the ON0 and OS0 values are not required. However, it's a VERY good idea to include them just in case. s2Member uses these variables for improved reliability across various scenarios. Also see: viewtopic.php?f=40&t=12449&src_doc_v=110709#src_doc_S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0

Re: Using paypal created buttons

PostPosted: July 9th, 2011, 4:32 pm
by Jason Caldwell
I'm taking a look at the Sandbox handling of Button Encryption. Others have reported problems testing Button Encryption in Sandbox Mode too. I'm not sure yet if this is a problem on the PayPal Sandbox side, or if there is something we need to update. Investigating now.

Re: Using paypal created buttons

PostPosted: July 11th, 2011, 9:36 pm
by Jason Caldwell
Still investigating encrypted buttons in Sandbox mode.
Referencing this thread: https://www.x.com/message/211059#211059

Re: Using paypal created buttons

PostPosted: July 15th, 2011, 3:25 pm
by PseudoNyhm
Jason Caldwell wrote:Still investigating encrypted buttons in Sandbox mode.
Referencing this thread: https://www.x.com/message/211059#211059


Thank you for following up on the encrypted button sandbox issue (reported in this thread as well).

I've been following along at x.com. Looks like you were able to convince PayPal that their sandbox is broken.

Re: Using paypal created buttons

PostPosted: July 15th, 2011, 9:56 pm
by Jason Caldwell
Thank you. Yes, I'm still awaiting a final resolution from PayPal, but their support was able to reproduce the issue with the API call data that I submitted to them. Referencing this thread again:
https://www.x.com/message/211059#211059

For the benefit of other readers. I will update this thread once the issue is resolved. At this time though, Encrypted PayPal Buttons are broken during Sandbox testing ( awaiting resolution from PayPal ). This should not affect live PayPal accounts though.

Re: Using paypal created buttons

PostPosted: August 4th, 2011, 1:53 pm
by thinkbig
Hi There,

I'm trying to use a paypal generated button along with the Wordpress Affiliate Platform plugin. Apparently this doesn't work. Do I have to use the short code from s2 to have the sale tracked? I was having a problem with the shortcode used within a reveal plugin that I was also using, so I generated a button from paypal, which works, but when I tested it, the sale was not tracked.

Any suggestions?

Re: Using paypal created buttons

PostPosted: August 4th, 2011, 1:59 pm
by Jason Caldwell
thinkbig wrote:Hi There,

I'm trying to use a paypal generated button along with the Wordpress Affiliate Platform plugin. Apparently this doesn't work. Do I have to use the short code from s2 to have the sale tracked? I was having a problem with the shortcode used within a reveal plugin that I was also using, so I generated a button from paypal, which works, but when I tested it, the sale was not tracked.

Any suggestions?

Yea, I believe this affiliate software is integrated with s2Member Shortcodes, and so if you use something other than a Shortcode, tracking will likely fail. To be sure, I would contact the developer of this application and ask them. I've been in contact with them in the past, so if they need any assistance from us in this regard, they can feel free to contact us: http://www.s2member.com/contact/

Re: Using paypal created buttons

PostPosted: August 4th, 2011, 2:59 pm
by thinkbig
Now I'm lost, I finally got my paypal button to work, but now I can't figure this affiliate plugin out. I followed the instructions, but it's not working and now I'm basically lost.

Also, I just viewed my site in firefox, it's not working properly...I normally use Chrome and that is what I've been viewing it through.

Here is my site: http://buildablogblueprint.com/ ,

For the Wordpress Affiliate Platfrom, do I need to Enable 3rd Party Cart Integration? The instructions don't specify.

:oops:

Re: Using paypal created buttons

PostPosted: August 4th, 2011, 8:31 pm
by Jason Caldwell
thinkbig wrote:For the Wordpress Affiliate Platfrom, do I need to Enable 3rd Party Cart Integration? The instructions don't specify.
I'd love to help, but that's really a question for the developer of that plugin please.

Re: Using paypal created buttons

PostPosted: August 5th, 2011, 9:30 am
by thinkbig
Ok, here's where I'm stuck, I got this reply from the people over at WP Affiliate platform,

"If you are manually creating that button then you should be able to tweak your script to read the cookie value from the browser and add it to the custom field value. You need to read the following Cookie Value:

ap_id

you can read the cookie value using the following code if this is a PHP script:

<?php $_COOKIE['ap_id]; ?>"

But I'm not sure how to implement this, I'm a newbie and don't want to screw it up. Is there any easy answer or example? Do I just edit the code Paypal generates for me?

Re: Using paypal created buttons

PostPosted: August 6th, 2011, 11:35 am
by Jason Caldwell
Sure, can we please see a copy of the Button Code and/or Shortcode that you're using for s2Member?

Re: Using paypal created buttons

PostPosted: August 6th, 2011, 3:27 pm
by thinkbig
Thanks Jason, you provide awesome support, here is the code below (for some reason the short code wasn't integrating with the wpreveal plugin I'm using, but the long code was, which is fine to use right?), I generated the code through s2's feature, also, will there be something special I need to do to use php inside of a page? (Not really sure what I'm talling about, just noting the "This may contain PHP code too; so be careful if you use this." note at the bottom of the s2's paypal button long code:

Code: Select all
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="business" value="marketingmagnetic@ymail.com" />
<input type="hidden" name="cmd" value="_xclick" />
<!-- Instant Payment Notification & Return Page Details -->
<input type="hidden" name="notify_url" value="http://buildablogblueprint.com/?s2member_paypal_notify=1" />
<input type="hidden" name="cancel_return" value="http://buildablogblueprint.com/" />
<input type="hidden" name="return" value="http://buildablogblueprint.com/?s2member_paypal_return=1" />
<input type="hidden" name="rm" value="2" />
<!-- Configures Basic Checkout Fields -->
<input type="hidden" name="lc" value="" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="custom" value="buildablogblueprint.com" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="page_style" value="paypal" />
<input type="hidden" name="charset" value="utf-8" />
<input type="hidden" name="item_name" value="full access" />
<input type="hidden" name="item_number" value="1" />
<!-- Configures s2Member's Unique Invoice ID/Code  -->
<input type="hidden" name="invoice" value="<?php echo S2MEMBER_VALUE_FOR_PP_INV(); ?>" />
<!-- Identifies/Updates An Existing User/Member ( when/if applicable )  -->
<input type="hidden" name="on0" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0; ?>" />
<input type="hidden" name="os0" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0; ?>" />
<!-- Identifies The Customer's IP Address For Tracking -->
<input type="hidden" name="on1" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1; ?>" />
<input type="hidden" name="os1" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1; ?>" />
<!-- Controls Modify Behavior At PayPal® Checkout -->
<input type="hidden" name="modify" value="0" />
<!-- Customizes Prices, Payments & Billing Cycle -->
<input type="hidden" name="amount" value="1.00" />
<!--<input type="hidden" name="src" value="BN" />-->
<!--<input type="hidden" name="srt" value="" />-->
<!--<input type="hidden" name="sra" value="1" />-->
<!--<input type="hidden" name="a1" value="0" />-->
<!--<input type="hidden" name="p1" value="0" />-->
<!--<input type="hidden" name="t1" value="D" />-->
<!--<input type="hidden" name="a3" value="1.00" />-->
<!--<input type="hidden" name="p3" value="1" />-->
<!--<input type="hidden" name="t3" value="L" />-->
<!-- Displays The PayPal® Image Button -->
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" style="width:auto; height:auto; border:0;" alt="PayPal®" />
</form>

Re: Using paypal created buttons

PostPosted: August 6th, 2011, 8:00 pm
by thinkbig
One more thing, I just noticed the "custom capabilities" form located within the paypal button generator, do I just need to enter a value into the custom capability field?

Re: Using paypal created buttons

PostPosted: August 6th, 2011, 8:30 pm
by thinkbig
Also, I wanted to include this info to as it might help figure out the problem:

"I am using a reveal code" - That would be the issue... see the attached screenshot to see how the button code looks like. It's missing the affiliate cookie value in the "custom" field. The s2Member has a filter that it executes to add the affiliate cookie ID in the custom field at page load time. The method you are using to place the button on the page must be going around this API so the custom field never gets the cookie value in there.

If you are manually creating that button then you should be able to tweak your script to read the cookie value from the browser and add it to the custom field value. You need to read the following Cookie Value:

ap_id

you can read the cookie value using the following code if this is a PHP script:

<?php $_COOKIE['ap_id]; ?>

The custom field should look like the following when you add the cookie value correctly (given "test1" is the affiliate in this case):

<input type="hidden" name="custom" value="buildablogblueprint.com|test1" />

Re: Using paypal created buttons

PostPosted: August 7th, 2011, 12:09 pm
by Jason Caldwell
Yea, integrating the Full Button Code ( i.e. RAW HTML/PHP code ), can be challenging. This code is really intended for developers integrating s2Member in creative ways. In your case, it sounds like you're facing some additional challenges because you're not only integrating the RAW code, but you're also trying to get it working with another plugin that uses JavaScript manipulations.

Here is how your RAW code should look. This is integrated with the tracking cookie value, and please remember that this code DOES contain PHP tags. You will need to make sure that your installation of WordPress has a PHP Execution plugin installed. After installing the PHP execution plugin, if you still have trouble, I would suggest contacting the developer of the JavaScript "reveal" plugin you mentioned and see if they can shed some light as well. Hopefully that won't be needed though.

Please install this plugin first
http://wordpress.org/extend/plugins/php ... on-plugin/

Then formulate your RAW Button Code like this:
( note how I added the cookie value to the custom input value )
Code: Select all
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="business" value="marketingmagnetic@ymail.com" />
    <input type="hidden" name="cmd" value="_xclick" />
    <!-- Instant Payment Notification & Return Page Details -->
    <input type="hidden" name="notify_url" value="http://buildablogblueprint.com/?s2member_paypal_notify=1" />
    <input type="hidden" name="cancel_return" value="http://buildablogblueprint.com/" />
    <input type="hidden" name="return" value="http://buildablogblueprint.com/?s2member_paypal_return=1" />
    <input type="hidden" name="rm" value="2" />
    <!-- Configures Basic Checkout Fields -->
    <input type="hidden" name="lc" value="" />
    <input type="hidden" name="no_shipping" value="1" />
    <input type="hidden" name="no_note" value="1" />
    <input type="hidden" name="custom" value="buildablogblueprint.com|<?php echo esc_attr($_COOKIE["ap_id"]); ?>" />
    <input type="hidden" name="currency_code" value="USD" />
    <input type="hidden" name="page_style" value="paypal" />
    <input type="hidden" name="charset" value="utf-8" />
    <input type="hidden" name="item_name" value="full access" />
    <input type="hidden" name="item_number" value="1" />
    <!-- Configures s2Member's Unique Invoice ID/Code  -->
    <input type="hidden" name="invoice" value="<?php echo S2MEMBER_VALUE_FOR_PP_INV(); ?>" />
    <!-- Identifies/Updates An Existing User/Member ( when/if applicable )  -->
    <input type="hidden" name="on0" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0; ?>" />
    <input type="hidden" name="os0" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0; ?>" />
    <!-- Identifies The Customer's IP Address For Tracking -->
    <input type="hidden" name="on1" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1; ?>" />
    <input type="hidden" name="os1" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1; ?>" />
    <!-- Controls Modify Behavior At PayPal® Checkout -->
    <input type="hidden" name="modify" value="0" />
    <!-- Customizes Prices, Payments & Billing Cycle -->
    <input type="hidden" name="amount" value="1.00" />
    <!--<input type="hidden" name="src" value="BN" />-->
    <!--<input type="hidden" name="srt" value="" />-->
    <!--<input type="hidden" name="sra" value="1" />-->
    <!--<input type="hidden" name="a1" value="0" />-->
    <!--<input type="hidden" name="p1" value="0" />-->
    <!--<input type="hidden" name="t1" value="D" />-->
    <!--<input type="hidden" name="a3" value="1.00" />-->
    <!--<input type="hidden" name="p3" value="1" />-->
    <!--<input type="hidden" name="t3" value="L" />-->
    <!-- Displays The PayPal® Image Button -->
    <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" style="width:auto; height:auto; border:0;" alt="PayPal®" />
    </form>

Re: Using paypal created buttons

PostPosted: August 7th, 2011, 1:14 pm
by thinkbig
Thanks for the help Jason, I gave this a try and it doesn't seem to be working, I installed the php execution plugin, and copied and pasted your code, the sale goes through, but it isn't tracked, if you view the page source here: http://buildablogblueprint.com/?ap_id=test1, you can see the code isn't picking up the affiliate, this line here <input type="hidden" name="custom" value="buildablogblueprint.com|" />

Should be: <input type="hidden" name="custom" value="buildablogblueprint.com|test1" />

So I guess I'll try to get in touch with the people from the wpreveal plugin, please let me know if you have any ideas on what I can try next,

Thanks,

Re: Using paypal created buttons

PostPosted: August 7th, 2011, 1:46 pm
by Jason Caldwell
I just took a look. This DOES seem to work, but please update your code snippet to this please:
Code: Select all
    <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
        <input type="hidden" name="business" value="marketingmagnetic@ymail.com" />
        <input type="hidden" name="cmd" value="_xclick" />
        <!-- Instant Payment Notification & Return Page Details -->
        <input type="hidden" name="notify_url" value="http://buildablogblueprint.com/?s2member_paypal_notify=1" />
        <input type="hidden" name="cancel_return" value="http://buildablogblueprint.com/" />
        <input type="hidden" name="return" value="http://buildablogblueprint.com/?s2member_paypal_return=1" />
        <input type="hidden" name="rm" value="2" />
        <!-- Configures Basic Checkout Fields -->
        <input type="hidden" name="lc" value="" />
        <input type="hidden" name="no_shipping" value="1" />
        <input type="hidden" name="no_note" value="1" />
        <input type="hidden" name="custom" value="buildablogblueprint.com|<?php echo esc_attr($_COOKIE["ap_id"]); ?>" />
        <input type="hidden" name="currency_code" value="USD" />
        <input type="hidden" name="page_style" value="paypal" />
        <input type="hidden" name="charset" value="utf-8" />
        <input type="hidden" name="item_name" value="full access" />
        <input type="hidden" name="item_number" value="1" />
        <!-- Configures s2Member's Unique Invoice ID/Code  -->
        <input type="hidden" name="invoice" value="<?php echo S2MEMBER_VALUE_FOR_PP_INV(); ?>" />
        <!-- Identifies/Updates An Existing User/Member ( when/if applicable )  -->
        <input type="hidden" name="on0" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0?>" />
        <input type="hidden" name="os0" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0?>" />
        <!-- Identifies The Customer's IP Address For Tracking -->
        <input type="hidden" name="on1" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1?>" />
        <input type="hidden" name="os1" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1?>" />
        <!-- Controls Modify Behavior At PayPal® Checkout -->
        <input type="hidden" name="modify" value="0" />
        <!-- Customizes Prices, Payments & Billing Cycle -->
        <input type="hidden" name="amount" value="1.00" />
        <!--<input type="hidden" name="src" value="BN" />-->
        <!--<input type="hidden" name="srt" value="" />-->
        <!--<input type="hidden" name="sra" value="1" />-->
        <!--<input type="hidden" name="a1" value="0" />-->
        <!--<input type="hidden" name="p1" value="0" />-->
        <!--<input type="hidden" name="t1" value="D" />-->
        <!--<input type="hidden" name="a3" value="1.00" />-->
        <!--<input type="hidden" name="p3" value="1" />-->
        <!--<input type="hidden" name="t3" value="L" />-->
        <!-- Displays The PayPal® Image Button -->
        <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" style="width:auto; height:auto; border:0;" alt="PayPal®" />
        </form>

Re: Using paypal created buttons

PostPosted: August 7th, 2011, 2:12 pm
by thinkbig
Jason, you're the man!! It seems to be working now, I thought I was maybe going to have to give up on the reveal method, but now it looks like that won't be the case.

Just one more thing...I promise...lol. I have the price set at $1.00 for testing purposes, I want to change the price to $97. Can I just edit the existing code?

Would it be these 2 lines:
<input type="hidden" name="amount" value="1.00" />
&
<!--<input type="hidden" name="a3" value="1.00" />-->

Where'd I'd change "1.00" to "97.00"?

Or do I need to generate a new button and edit that code for everything to work?

Thanks again for all of your help and fast responses, I really appreciate it.

Re: Using paypal created buttons

PostPosted: August 7th, 2011, 2:41 pm
by Jason Caldwell
You're very welcome.
Yep, just change this line. The others don't need to be changed, they're commented out anyway. In fact, you could just remove those lines that are commented out. They're invisible to a browser.
Code: Select all
<input type="hidden" name="amount" value="97.00" />

Re: Using paypal created buttons

PostPosted: August 7th, 2011, 4:17 pm
by thinkbig
Ok, just wanted to check one more thing. I deleted these 9 lines from the code, they were creating a --> showing up when viewing the page in the firefox browser, I just want to make sure they weren't doing anything:

<!--<input type="hidden" name="src" value="BN" />-->
<!--<input type="hidden" name="srt" value="" />-->
<!--<input type="hidden" name="sra" value="1" />-->
<!--<input type="hidden" name="a1" value="0" />-->
<!--<input type="hidden" name="p1" value="0" />-->
<!--<input type="hidden" name="t1" value="D" />-->
<!--<input type="hidden" name="a3" value="1.00" />-->
<!--<input type="hidden" name="p3" value="1" />-->
<!--<input type="hidden" name="t3" value="L" />-->

Screenshot of webpage in firefox brower before I deleted lines: http://buildablogblueprint.com/wp-conte ... 7_1652.png

Re: Using paypal created buttons

PostPosted: August 7th, 2011, 4:19 pm
by Jason Caldwell
Yes, it's fine to do that.

Re: Using paypal created buttons

PostPosted: August 16th, 2011, 5:51 pm
by Researcher
Hi guys!

A quick question about Created Buttons through PayPal. I am using created buttons because I need a fixed amount Donation Option which is not currently available in S2 Member.

I am passing the variables; Item Id, custom & notify back to S2 Member.

The initial donation gives them 30 days access. During the initial 30 days they can upgrade to level 2 to give them ongoing access after the initial 30 days. (level 2 can be a recurring monthly donation or charge. Donation is preferable, but not required) If they don't upgrade to level 2 during the initial 30 days, they would have to remake the initial donation to be able to upgrade. So, if they don't upgrade in the first 30 days, they're out and would have to donate the initial lump sum again and start over.

My main question is: How do I limit the subscribers access to just 30 days? I see that this is an option through the PayPal buttons generated through S2 Member, but because I'm not using S2 generated buttons how do I accomplish this? I've looked through S2's options but I don't see this anywhere, where or how can I override/accomplish this.

Any comments or suggestions on my upgrade process would also be appreciated. Thanks, you guys are awesome!