Forum Moderators: buckworks
the reason I am here is that I have just finished reading about 250 pages on print of the Paypal manuals.
It got me somewhat confused.
Anyone out there who coudl help me with the following 2 or 3 questions?
Running a subscription (e-zine), recurrent each year, paied in EUR.
1) Question is: the IPN notification returns a POST variable named
txn_type which may hold the following values:
-) subscr_signup (is this a PAYMENT?)
-) subsc_cancel
-) subscr_failed
-) subscr_payment (now: what is the difference with subscr_signup?)
2) If an existing user is billed for an auto renewal, how does it arrive to my IPN page: i am currently assuming as a "subscr_payment" (but I could be wrong) but what type of variable does it bring to my ISP page so that I can IDENTIFY WHICH subscriber profile I have to update in my DB? It is NOT possible to let Paypal generate usernames and passwords, the system must assign its own. How can I understand it is a renewal for THAT specific subscriber?
3) If I have setup a IPN on paypal, then should the purchase online button sepcify that very same IPN url as the "automatic redirection" url, or is the system smart enought to automagically link the pay pal button to the active IPN address as the URL/I a subscription process should send back the purchaser once he has purchased?
yeah, convoluted. 250 pages of paypal are not a nuisance!
Manuals are just somewhat confusing: human intervention needed!
I have other questions but if I can get some clarifications about this already, that would be a good leap forward.
Thanks
[edited by: Alberto at 1:10 am (utc) on Sep. 14, 2006]
subscr_signup: subscription sign-up.
subscr_cancel: subscription cancellation.
subscr_failed: subscription payment failure.
subscr_payment: subscription payment.
subscr_eot: subscription's end-of-term.
subscr_modify: subscription modification.
If I'm not mistaken, signup is a new subscriber; payment is a regularly scheduled payment from an existing subscriber.
2) PayPal assigns a subscr_id value to each subscriber; this is not presented to the user as a username or password, and it can be used by your system to tie the PayPal subscription to the user's record in your DB. Or, if you want to assign your own ID, you can pass that in using the "custom" variable.
3) If you have enabled IPN in your account Profile and only have 1 URL where you need to receive those notifications, then you shouldn't need to include the URL in your subscription button. Only use the notify_url variable if you need to direct the information to a URL different from the default one configured in your IPN settings in your Profile.
You might find it easier to read the documentation that's available on the PayPal Integration Center. Look at the "IPN/PDT Variable Reference" section for all the supported variables & a helpful table of which variables are returned with each type of subscription event notification.
I have a few more doubts - well i guess it's somewhat natural when one is new at IPN:
settle_amount
is that the better variable to check for the definitive amount - that is, is it calculated subtracting the fee already?
Of course I could have checked this myself, but as one may guess... I am having problems with my tests.
using eliteweaver I am getting a:
HTTP Status: HTTP/1.1 200 OK
IPN Received: Your script did not reply!
My PHP script does this (I include only the relevant, or arguably relevant, snippet):
================================
$testmode=true;
$port=80;
$protocol='';
$headers='';
$domain='www.eliteweaver.co.uk';//testmode
$myPOSTDATA='';//this will become:
//cmd=_notify-validate&foo=hallo+world&foo2 etc...
//....stuff...
/*now prepare to send back to Paypal for VERIFICATION:*/
$headers.= 'POST /cgi-bin/webscr HTTP/1.0'."\r\n";
$headers.='User-Agent: PHP/'.phpversion()."\r\n";
$headers.='Server: '.$_SERVER['SERVER_SOFTWARE']."\r\n";
$headers.='Content-Type: application/x-www-form-urlencoded'."\r\n";
$headers.='Content-Length: '.strlen($myPOSTDATA)."\r\n\r\n";
$socket=fsockopen($protocol.$domain, $port, $errno, $errstr, 30);
if(!$socket){
print 'Socket error.';
}
else{
fputs($socket, $headers.$myPOSTDATA);
while(!feof($socket)){
$paypal_RESPONSE=fgets ($socket, 1024);
if(strcmp ($paypal_RESPONSE, 'VERIFIED') == 0){
================================
Any major issue that may be considered the 'culprit'? The script is just a minor rearrangement of the most popular IPN php manager (the one at Paypal itself...)
Thanks!
[edited by: Alberto at 9:47 am (utc) on Sep. 14, 2006]