I am开发者_运维问答 trying to figure out how to prevent users to subscribe more than once. I just completed a PHP application for premium membership using PayPal Subscriptions and IPN.
When users login to their account and if they are not yet premium members, they are present with the premium options they can select from a drop down list.
Once they subscribe, this form is hidden while their subscription is active. When the subscription expires, the form is shown again.
THE PROBLEM: The PayPal IPN notification is not instant and sometimes takes several minutes after successful subscription and before the first notice arrives. So the signup form is exposed during this time. Users may think their subscription did not work and may try to subscribe again. Without receiving the notice from PayPal, I have no way of knowing if the form should be hidden or not.
THE QUETION: What solution would you recommend to get around this problem?
Create subscription in your DB before you redirect user to paypal. Create special flag like active : 0. After you create inactive subscription pass to PP order_id parameter.
When you receive IPN just change subscription status active : 1
Thus you will not show subscription offer to users who is in progress but you will show another page like
Your subscription is in progress. please refresh this page in few minuts. If you still cannot get access, please contact admin.
精彩评论