Hi Ryan. Thanks for the great question.
If you're using the PayPal Button Shortcode ( even in the free version ), s2Member will automatically update an existing account, rather than creating a new one... so long as the Customer is logged into their account before you have them complete the checkout process. s2Member handles this automatically, through the use of these two variables, which are passed through to PayPal by s2Member automatically.
- Code: Select all
<!-- Identifies/Updates An Existing Member After Checkout -->
<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; ?>" />
Which evaluates automatically, to:
- Code: Select all
<!-- Identifies/Updates An Existing Member After Checkout -->
<input type="hidden" name="on0" value="Updating Subscr. ID" />
<input type="hidden" name="os0" value="[An existing Subscr. ID, or a WP User ID]" />
You'll see these variables in the full Button Code after you generate your PayPal Button in s2Member, under: s2Member -> PayPal Buttons.
The
on0 &
os0 parameters are received by s2Member after the checkout process at PayPal. When s2Member's IPN processor receives these variables, it uses them in the following way:
If on0 contains the word "Updating", or "Upgrading", and the os0 variable contains an existing PayPal Subscription ID, or a valid WordPress User ID, matching an existing User in the system, s2Member will update an existing account matching that ID.This works the same way in s2Member Pro, only it's handled automatically by the s2Member Pro Forms, through connections to the PayPal API; as opposed to using PayPal Buttons.
In either case, the trick is that you need existing Customers to be logged in, before you have them start a new checkout process. This will even work for Free Subscribers that are upgrading to a paid account. Just make sure the Free Subscriber is logged in before they start the checkout process.
In other words, an upgrade button on their Login Welcome Page, is the best way. In s2Member Pro, you can generate PayPal Pro Modification Forms, that handle all of this automatically. s2Member will force the Customer to login before the checkout process begins; just to remove any doubt.
Please let me know if anything here is unclear. ~Thanks.