martonic wrote:Hi Jason,
I really like this tool, and I'm keen to get the pro version. My client needs to integrate membership purchases into an accounting system.
My "usual" method would be to have the user register first, then send the userID as "custom", then call an additional back-end process on IPN (either from notify_URL or using your notification API feature).
However, I am not quite clear on how to make this go through in this context. I could for instance restrict the "Purchase" page to users who have already registered for a WP login.
But - How does s2member connect the Paypal transaction with the member who made it - especially if they have not yet registered? What is the key field - is it Email? But then ... what if two users share the same PAYPAL account - can they each purchase a subscription (different type, perhaps) and be separately identified?
Thanks again for your consideration - this is greatly appreciated.
Yea, we get this question a lot. "Register first, then pay", or "pay first, then register"? There really is not a right or wrong way to do this, it's really just a matter of preference.
s2Member ( by default ) has been designed to support "Pay first, then register", because this normally produces a higher conversion rate; since there are fewer obstacles in the way ( before payment is received ). It also makes s2Member more flexible and easier to integrate into a variety of situations. Given the limitations of
PayPal Standard integration, the signup process has to be at least 2 steps; so we tried to choose the lesser of two evils.
The real solution ( in our opinion ) is to combine Registration/Checkout into a single step. That's how s2Member Pro works. The
s2Member Pro Module makes it possible for s2Member to use
PayPal® Pro Forms ( instead of standard
PayPal® Buttons ).
PayPal® Pro Forms integrate seamlessly with WordPress® Shortcodes. This allows you to keep Customers on your site at all times, and it consolidates the Checkout / Registration steps into a single form that you can dress up just the way you like. [ see:
viewtopic.php?f=4&t=304 ]
But - How does s2member connect the Paypal transaction with the member who made it - especially if they have not yet registered? What is the key field - is it Email? But then ... what if two users share the same PAYPAL account - can they each purchase a subscription (different type, perhaps) and be separately identified?
There are a few different scenarios in which s2Member will need to identify a Customer before an upgrade, and/or before a paid Registration occurs. Before I explain each of them briefly, let me just say that s2Member goes to great lengths to ensure no Customer is ever left out-in-the-cold. The processes by which s2Member verifies/validates/and secures registration and account upgrades is pretty solid.
1. A first-time Customer returns from PayPal, after checkout.After completing a payment through
PayPal, a Customer is either brought back to your Registration Form immediately, or they are sent an email with a link to the Registration Form. In many cases, the Customer will be provided with both options. That is, they'll be brought back to your site immediately, and the Signup Confirmation Email will also be sent.
In either case, s2Member identifies the Customer as having paid for Membership using a combination of
PayPal's PDT ( Payment Data Transfer ) service, and IPNs ( Instant Payment Notifications ). These services, ultimately result in the creation of three temporary cookies set in the browser of a Customer, which identifies a unique Subscription ID, or a unique Transaction ID, which will be tied to the Customer's account, and is only valid for a single Registration. I won't go into the full details of this process here. If you'd like to see for yourself how the process works, you can have a look inside
/s2member/includes/functions/register-access.inc.phpIn particular, have a look at line # 320-3252. An existing Customer, and/or Free Subscriber is upgrading/downgrading their account.This scenario works with ANY account that is already in the system, even if they are just a Free Subscriber, and even if they are not yet associated with a paid Transaction ID / Subscription ID.
s2Member sends two special variables through the
PayPal Button Code.
- Code: Select all
<!-- Identifies/Updates An Existing Member After Checkout -->
<input type="hidden" name="on0" value="Updating" />
<input type="hidden" name="os0" value="123" />
<input type="hidden" name="modify" value="1" />
Where 123 is the existing account ID of the User, or this can also be the existing paid Subscription ID. For full documentation on how these variables work ( in conjunction with the s2Member API ), please read this section in your WP Dashboard:
s2Member -> API Scripting -> API Constants ( at the very bottom of that section, you'll find a discussion on this topic.
S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0
S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS03. An existing paid Subscriber is modifying their paid Subscription through PayPal.This scenario results in a "subscr_modify" IPN transaction being received by s2Member. In this case, s2Member is capable of updating an existing account based on the data provided in the IPN response. ( i.e. the "subscr_id" variable ).
what if two users share the same PAYPAL account - can they each purchase a subscription (different type, perhaps) and be separately identified?
Yes, because the account is identified by the Subscription ID, and/or a Transaction ID.
However, I should note that WordPress does NOT allow the same email address to be used more than once. So although two Customers can use the same PayPal account, whenever they complete payment, they must register themselves with two different email addresses. Which is usually NOT an issue, because most people do not share email addresses.If this information does not answer all of your questions, please read through the API Scripting section, and most importantly, the API Constants section, under: s2Member -> API Scripting -> API Constants. Understanding the API Constants, usually leads to a more complete understanding about how s2Member stores information for each Customer.