Hi,
We're hoping to create an UberCart module which can tap into the PayPal recurring payments or subscriptions API. Here's some background information, followed by a description of the type of functionality we're looking for:
Using PayPal's "Website Payments Standard" service, merchants can create PayPal "add to cart" buttons by filling out a form on the PayPal website. This form generates HTML code which can then be embedded into the merchant's website. When customers click on one of these PayPal buttons, product information and other variables are passed to the PayPal website, where the customer completes the check-out process by filling in their credit card information, etc. When finished, the customer is re-directed back to the merchant's website.
I'm sure you're all familiar with this process.
This functionality has been integrated into UberCart via the "uc_paypal" module. When the "PayPal Website Payments Standard" payment method is enabled in UberCart, and the customer chooses this method during check-out, UberCart gathers the relevant product information, formats it into a string, then passes the information to the PayPal API. This works great, but we're hoping to expand upon this functionality by adding a recurring payments (or pay-by-installments) option.
I've looked into UberCart's "uc_recurring" module, but I don't think it can be leveraged to fulfill our specific requirements.
Here's a link to a page on the PayPal website which explains their recurring payments feature. From what I understand, "Website Payments Pro" is required to leverage this functionality:
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=develo...
Here's a link to PayPal's "Create PayPal payment button" page, where merchants can fill out a form and generate HTML code to embed into their websites. Notice the "Recurring amount to be billed", "Billing cycle" and "After how many cycles should billing stop?" fields. We'd like to create an UberCart module which can pass this information from UberCart to PayPal, via PayPal's recurring payments API:
https://www.paypal.com/us/cgi-bin/webscr?cmd=_button-designer&factory_ty...
Here's our ideal scenario:
• We have a product class called "fitness camp" with a "duration" attribute assigned to it (options are 1 month, 4 months, 6 months, etc).
• On the product page, customers choose a duration from the list, then click "add to cart".
• Customers pay the first installment immediately, and are informed that they will be billed in intervals for the remaining installments. The number of installments is based on their chosen duration (eg. 4 months = 4 payments).
• Once the first installment is paid for, PayPal automatically bills the customer each month, until the end of the duration.
• The administrator is able to define the "Recurring amount to be billed" and "Billing cycle" options for each of the "fitness camp" products. The "After how many cycles should billing stop?" option is determined by the product's "duration" attribute (eg. 4 months = 4 cycles), which is chosen by the customer. Choosing "1 month" results in a one-time purchase, and no recurring billing is established.
• The administrator is able to cancel and/or change recurring billing arrangements at any time, though the UberCart website, without having to login to the PayPal website.
Would anyone be interested in extending the "uc_paypal" module to incorporate this functionality? Alternatively, would anyone be interested in writing a custom module to help us accomplish this? Are there existing solutions available, which I'm not aware of? We're willing to sponsor the development of this feature, but we need to start quickly, so please don't hesitate to contact me!
Thanks!
Mark Plewis
Rhubarb Media Inc.
Here's some related information I was able to dig up:
http://drupal.org/node/328445
http://restaurant-equipment-parts.net/forum/development/5898/installments
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | paypal_recurring_zero.jpg | 27.34 KB | carteriii |
| #16 | recurring_fee_options.jpg | 29.49 KB | carteriii |
| #16 | recurring_fee_attributes.jpg | 18.9 KB | carteriii |
| #16 | recurring_fee_features.jpg | 21.9 KB | carteriii |
| #9 | uc_paypal.recurring.5.patch | 27.98 KB | cha0s |
Comments
Comment #1
sunsetco commentedDid you get any takers for this?
I am interested in the same type of functionality for my site. I may have a programmer that I think can tackle this, but I am not sure how much time it would take him yet. Plus, don't want to reinvent the wheel if you had this completed...
Phil Hurley
Sunset Computer Services
Comment #2
rszrama commentedAfaik, Mark actually went another route for the related project. There is actually some sponsored code in the work that might surface as a patch in the near future for D6.
Comment #3
cha0s commentedI'm putting on my robe and wizard hat...
Comment #4
cha0s commentedVoilà.
Notes:
Added a new hook, uc_paypal_ipn() to handle new IPN types.
When updating recurring payments with PayPal, they only allow you to change the CC expiration date, not the number or card type.
Comment #5
cha0s commentedEr, patch might be good, eh!?
Comment #6
cha0s commentedUpdated the IPN system... now with 60% betterness.
Comment #7
rszrama commentedCode looks great - already chatted w/ cha0s about commenting three functions and then I'll do some quick testing before committing!
Comment #8
cha0s commentedPatch with new comments:
Comment #9
cha0s commentedI forgot to post my latest patch here from yesterday...
This one takes into account the fact that PayPal may reuse transaction IDs, and recurring payments shouldn't fail if that's the case.
Comment #10
carteriii commentedI applied the latest patch and then, hoping for the best, simply placed an order with recurring fees hooked to PayPal and simply didn't see anything. I don't see a recurring fee in PayPal, and I don't see any entries listed in the "recurring fees" screen (through store admin -> orders).
I'm about to start poking through the code, but I'm not really even sure where to start looking for what should have happened. I grep'ed for "hook_recurring_fee" through all of ubercart and see instances in uc_recurring.module, uc_paypal.module and uc_authorizenet.module, but I can't figure out what initiates that hook to be able to figure out if the PayPal hook is even being called. Can someone offer some documentation or even just thoughts on what should happen and how to debug this?
Thanks in advance.
UPDATE: I've found that uc_recurring_order appears to initiate things, but for some reason my uc_recurring_order function isn't getting called. Now I'm trying to figure out who calls hook_order with an operation of 'submit' and can't find the source of that. Unfortunately grep'ing for 'submit' isn't particularly helpful.
UPDATE #2: It appears that the core issue is that the 'Submit Order' button on the review page has a form action of https://www.paypal.com/cgi-bin/webscr rather than calling the function uc_cart_checkout_review_form_submit() which would appear to be the default, and in turn would call hook_order('submit'). So now the question is, why is this form not going through the "normal" functions and taking a short-cut directly to PayPal?
UPDATE #3: I've now found that uc_paypal_form_alter() changes the 'submit' button on the uc_checkout_review_form to instead have the form action that goes directly to paypal. That appears to be to be a bug/problem that would prevent the PayPal recurring payments from ever being processed. Perhaps I'm missing something, but I think I'm done debugging at this point and really need someone else to tell me what's happening. It feels as if the patch file didn't include something it should.
Comment #11
cha0s commentedcarteriii, are you using the WPP payment gateway with credit as the payment method?
Comment #12
carteriii commentedYes. I'm under the impression that's what I have to use for the recurring payments to work. Was that a bad assumption?
Edit: Actually the payment method is "Website Payments Standard", which is how I've been accepting credit card payments to date (the user enters the credit card directly into the PayPal web interface). Is that incorrect?
Comment #13
cha0s commentedYes, unfortunately that is incorrect. You must use the Website Payments Pro gateway in order to create recurring payment profiles. You would then use a payment method such as credit, and set the gateway to Website Payments Pro.
FWIW, when I did tests it was not through a PayPal interface, but by giving my CC number in the checkout screen... PayPal is totally invisible to the user when doing these transactions.
Comment #14
carteriii commentedLooks like this is going to require a lot more work than I expected (or at least hoped). Previously I didn't have or need an SSL cert because the credit card information was all submitted directly through PayPal's web pages. To use at least this implementation of recurring payments, it appears all that changes and I now need to get an SSL cert, configure the secure pages module, etc. etc.
As you looked into implementing recurring payments w/PayPal, by any chance did you see another way to do this by using the PayPal web pages for credit card submission (ala Web Payments Standard)?
On a related topic, does any other payment gateway support recurring payments with an interface similar to PayPal's web payments standard, such that I might not need to bite the bullet and get the SSL cert, etc.?
Comment #15
cha0s commentedIn fact, I think there is a way to do it, but the work I did was sponsored work, and I didn't get the go for doing recurring payments with Direct Checkout...
Comment #16
carteriii commentedI'm back, and having some problem. The short version is that the first recurring payment in PalPal charges $0 for some reason.
I'm going to attach several screenshots of the screen in PayPal, and then my options, attributes, & features setup within Ubercart. Would you please tell me if I simply don't have something setup correctly?
Note that the PayPal screen shows a "Trial Period" of 1 cycle with $0 fee. Could that be the problem? Was that trial period hard-coded into the integration?
A hack/workaround seems that I might be able to say to simply start the recurring payments immediately, but I'm afraid that if the code is "fixed" (assuming there is even a problem) that suddenly I'd double-charge customers when they make the initial purchase.
Comment #17
cha0s commentedYeah, that was intentional. I was following what I saw in other payment gateways implementing this functionality. The initial payment is handled by the normal credit method.
If you charged right away, you WOULD be double charging customers.
Comment #18
carteriii commentedFirst of all, thanks for the response.
Let me ask if that's really the right way to do things given that the recurring fee functionality specifically allows users to specify the time period to wait before making the first charge. It seems that recurring fees in Ubercart may simply be more flexible than other systems, and therefore doesn't need the integration to explicitly ignore the first payment.
I'm talking about the "Initial charge" selection of a feature that says, "Specify the time to wait to start charging the recurring fee after checkout. Remember the product price will be charged at the time of checkout."
That setting would seem to handle the situation perfectly without any extra work on your part in the integration. Unfortunately now that setting is effectively only one-half of the real time. So if I say to wait one month before making the first recurring payment, the effect is that it actually waits 2 months.
Are you open to considering that the explicit skipping of a time period may be confusing and/ simply not be necessary?
Comment #19
carteriii commentedIs this patch going to be included in the core? It obviously hasn't been, despite other changes to the recurring payments module and to the PayPal module. Since there is a status of "patch (to be ported)" which seems like the right thing to do, I'm going to go out on a limb and set that status. I'll apologize now if that's not appropriate.
Comment #20
jmlavarenne commentedWon't this module do the trick? http://drupal.org/project/uc_paypal_buttons
It needs to be upgraded to 6.x, but it seems from the module description to be offering recurring payment in the form of subscriptions, and all activity takes place on the paypal site, negating the need for SSL.
Comment #21
carteriii commentedUnfortunately the buttons are for specific products, so not really appropriate for a shopping cart into which several products might be purchased, and perhaps a discount applied.
Comment #22
thill_ commentedThis should be moved to the Uc_recurring project now, it is also a duplicate now of #449318: Paypal Recurring Payment
Comment #23
iapostolos commentedHi,
I recently applied the patch with no problems. I had some existing recurring fees set up using the old method. I assumed that this would automagically work. I purchased a recurring fee product and everything works exactly the same as it used to. Nothing about recurring fees showed up in my sandbox account, just an instant payment type. Could you help me out and tell me what I am forgetting to do. Do I need to create any new attributes ? products ? forms ? Thanks in advance.
Comment #24
iapostolos commentedOk, I needed to change the recurring fees handler to paypal. Is there a way to use the trial period in paypal, I noticed there is no way no charge the initial product fee.