I think the problem posted by srahul07 http://drupal.org/node/1229454#comment-6136694 is certainly valid. and we definatly need to something like that happens in authorize.net module which sets trial periods after checking for a flag.
Anyways, I will try to keep up with this thread, I have got it working for a client website, The problem is and this is after lots and lots of debugging and writing tickets to Paypal support.
1. We need to set the IPN callback in the merchant account.
I contacted Paypal with a very specific question asking if my request response are fine wrt to setting up the recurring payment, the reply from paypal was,
Your integration is handling the IPN URL by Code directly for the Direct Payment API, that's true and its working fine. However, our CreaterecurringPayments API is currently not supporting the Parameter NOTIFYURL. For that reason your store is not and cna't submit it directly for Recurring Payments.
To receive recurring Payment IPN's, you will need to setup a IPN URL in your PayPal account.
I confirmed this after seeing the API documentation for the API, so as paypal advised i setup the IPN callback as given in the uc_paypal module.
2. Handling of IPN
Well the good news was after this I started receiving IPN, but thats it I was receiving them else nothing happened. Again I got into debugging mode and took a look at the IPN callback. Its first line itself checks if the IPN contains a a invoice id which is ubercart's order id
if (!isset($_POST['invoice'])) {
watchdog('uc_paypal', 'IPN attempted with invalid order ID.', array(), WATCHDOG_ERROR);
return;
}
Which is all good and jolly for the first IPN which is recieved when you setup the order but, when the IPN is received when recurring takes place it will not work because in this case the order id is in the key 'rp_invoice_id' (which I think stands for recurring profile invoice id, just a guess)
so the code should be something like this,
if (!isset($_POST['invoice']) || !isset($_POST['rp_invoice_id'])) {
watchdog('uc_paypal', 'IPN attempted with invalid order ID.', array(), WATCHDOG_ERROR);
return;
}
if(isset($_POST['rp_invoice_id'])){
$order_id = intval($_POST['rp_invoice_id']);
}
else{
$order_id = intval($_POST['invoice']);
}
After doing this the rest of the callback will need to be tweaked for rest of the housekeeping stuff. I don't entirely see this as a problem with uc_recurring mainly because the IPN callback falls under ubercart's domain, the middle road might be for ubercart to create a process IPN hook so that uc_recurring can implement its own logic in the callback and not entirely rely on ubercart.
Hope this helps guys this issue has been going on for a while.
Cheers,
Swarad