Recurly has the ability to accept PayPal payments alongside regular credit card transactions. (I've already had people say they can't have credit cards in third world countries, so they can't subscribe to my site.) Right now, it works flawless with the hosted pages, but I'm using the Recurly Roles module, so I must use recurly.js.
When my Recurly account was enabled for PayPal transactions, they sent this link to info about getting PayPal to work with recurly.js. It looks fairly straightforward, but when I made the recommended changes, it didn't look or work quite right. So, I was wondering if this is something that can be fixed in the module, or if I must keep looking.
Here are some screenshots that may explain better:
This image shows the hosted page with PayPal as an option

This image show the hosted page with PayPal selected

This image shows the recurly.js page with the changes suggested... doesn't look or work correctly

| Comment | File | Size | Author |
|---|---|---|---|
| #70 | D8-recurlyjs_paypal_support-2096185-70.patch | 4.38 KB | loze |
| #54 | recurly-paypal-support-2096185-54.patch | 4.08 KB | jordanmagnuson |
| #49 | 2096185-49.patch | 5.42 KB | markdorison |
| #47 | 2096185-47.patch | 56.62 KB | markdorison |
| #46 | recurly.zip | 123.94 KB | jurriaanroelofs |
Comments
Comment #1
kcannick commentedI am also interested in this functionality.
Comment #2
mrded commentedWe will need to modify the acceptPaypal field on the form, as documented here: https://docs.recurly.com/api/recurlyjs/reference#js-buildSubscriptionForm
Comment #3
mrded commentedPlease, take a look my patch
Comment #4
quicksketchThanks @mrded! This looks great!! I'll take a look at it soon. The only part that needs visual review is how the new CSS looks, but from a technical side this all looks perfect.
Comment #5
jordanmagnuson commentedIs there a way to integrate PayPal so that we can actually use that tab theme/layout that's visible in the screenshots above?
Comment #6
quicksketchHm, I'm having trouble with this patch. After enabling the option for Paypal, the images for credit cards disappear on the checkout page:
When disabled, the cards come back but there is an unnecessary radio button next to the credit cards, since that's the only option:
So looks like we need a little more investigation here. I installed the latest version of the Recurly.js v2 library to test this.
Comment #7
jordanmagnuson commentedSame behavior I'm getting (#6).
Comment #8
mrded commentedWe need to think up something with CSS, because that version of css looks good on default theme only.
Any custom theme such as Bootstrap makes it really horrible.
Comment #9
quicksketchIt's not just the CSS, the markup for individual credit cards disappears when the Paypal option is enabled, so there's nothing to put the background images on. I think this may be an issue with Recurly.js rather than our code, which for the most part is just rendering what Recurly gives us.
Comment #10
quicksketchComment #11
quicksketchIt turns out this was a requirement on jQuery 1.7+. Once installing jQuery Update and using a newer version of jQuery, things worked much better. It's surprising that the older versions of jQuery actually worked at all without the Paypal option enabled.
I think it'd be reasonable for us to depend on jQuery Update; it's dangerous trying to depend on external libraries with core using an old version of jQuery. We should update this patch with additional documentation and hard requirements.
Comment #12
mrded commentedDo you want me to add jquery_update as dependencies to the patch? Or make it works on old jQuery?
Comment #13
quicksketchFor the time being, I've added just a check and description on the option itself for Paypal, considering everything else works even without jQuery Update. Considering the need to create a new version of the module anyway for RecurlyJS v3 (#2296401: Recurly.js v3), let's save the additional requirements for the new version.
This patch adds the additional documentation and jQuery Update check. Committed to 1.x branch, thanks @mrded!
Comment #16
quicksketchForgot the image in the first commit, sorry about that.
Comment #17
mrded commentedThanks! :)
Comment #19
jordanmagnuson commentedShouldn't the 'update billing information' tab be changed for PayPal customers?
A couple of reasons:
Screenshot of th eupdate billing tab with PayPal enabled: http://i.imgur.com/ln2OTbN.png
Comment #20
quicksketchThanks @JordanMagnuson, good idea. I personally haven't been able to test this beyond ensuring that the widget shows up properly because I do not have access to a commercial Paypal account. Any patches you can provide to correct this appearance would be appreciated.
I think for the billing page, it should probably indicate that current "Card on file" is actually their Paypal account. I imagine the billing information we retrieve has a property of some kind to indicate it's a Paypal account.
You're correct that it seems as though PayPal users can't update their billing information, per Recurly:
We should indicate as much on the update billing information page, since this does not match user expectations (for which I'd think it'd be quite natural to think you could switch between Paypal and Credit Cards).
Comment #21
jordanmagnuson commentedI just took a look what Recurly does for 'update billing information' on their hosted payment pages for PayPal accounts, here's a screenshot: http://i.imgur.com/wUpEdLO.png
The 'update billing information' button then takes the user to PayPal to set up a new billing agreement.
@quicksketch: like you say, I think we could do them one better and provide some more useful information here, including the fact that the user cannot switch to credit card billing unless they cancel their subscription and start a new one, and also an indication that if their payment is being declined, they should update their payment method on PayPal (e.g. update their credit card details or bank details on PayPal directly), with a link to log into Paypal.
Comment #22
aburke626Comment #24
kcannick commentedIs there a dev release that his has been committed to because I don't see it?
Comment #27
aburke626Comment #28
thpoul commentedSince #2666950: PayPal support has been closed as duplicate but has not been answered here (except the version change), is there an eta on implementing this? What should be the next steps to move this forward?
Comment #29
markdorisonI have never used this functionality on the 7.x-1.x branch so I am not familiar with the specific functionality that it provides nor can I say that I have an immediate need for adding it. If you (or anyone) is interested in contributing to getting this implemented, I would recommend beginning documenting the specific functional requirements here, or in more granular child tickets if necessary. Then, as they say, patches are welcome!
Comment #30
kcannick commentedI'm confused because I am currently utilizing recurly module and have paypal enabled (most of my subscription are processed through paypal). What is it that I'm missing? I am using 1.x version of module. Does this mean Paypal option isn't available in 2.x?
Comment #31
markdorison@Kcannick Paypal functionality has not yet been ported to 7.x-2.x.
Comment #32
nvhcuong commentedDear all,
I am working on a project with Recurly and payment by both Credit card and Paypal. I found a short way to intergrated Paypal with current Recurly module. I am using Recurly JS.
I attached 2 files: recurly-element.js_.txt and recurlyjs.pages_.inc_.txt . Could anyone help me to change it to patch file, or you can change it name to recurly-element.js and recurlyjs.pages.inc then overwrite them to sites/all/modules/recurly/modules/recurlyjs/
My solution is:
1. Create a button "Paypal" in subscription page.
2. Create Javascript function paypal_purchase to handler Paypal button click.
3. The paypal_purchase will go to recurly.paypal by Recurly docs. After process on Paypal, it will return a token id, assign this token id to subscription form. Then, submit this form
4. I make some change in recurlyJSTokenFormSubmit function to verify that: if token id have value then submit the form to next step, else get token from Recurly by normal way.
I tested in Recurly Production mode already and payment process successful.
Hope this solution help anyone needed and module author to make Paypal subscription work.
Any query please contact me.
Thanks!
Comment #33
markdorison@nvhcuong: Take a look at the following documentation: Making a Drupal patch with Git
Comment #35
markdorisonComment #36
kcannick commentedJust for some clarity... Is this patch included in Recurly 3x release. Because I updated to 3x previously and lost ability for users to pay through Paypal. Do I need to install dev release?
Comment #37
markdorison@Kcannick Paypal support has not yet been ported to the 7.x-3.x branch (or for that matter to 8.x-1.x). Patches are welcome.
Comment #38
jurriaanroelofs commentedunfortunately I don't have time to participate in issues but I posted a zip of my working 7.x-3.x with PayPal support here: https://www.drupal.org/node/2616832#comment-11971188
Comment #39
walangitan commentedComment #40
markdorisonComment #41
jordanmagnuson commentedThis is the major issue holding me back from the 7.x-3.x branch at the moment...
Comment #42
markdorisonComment #43
kcannick commentedI'd be willing to sponsor some development on this if anyone is interested or has time. Send me an quote to make happen.
@JordanMagnuson would you be willing to go in on this as well?
Comment #44
jordanmagnuson commentedYes, I would be willing to sponsor development of working PayPal integration committed to the main branch of 7.x-3.x.
Comment #45
jordanmagnuson commentedI need PayPal integration with 7.x-3.x ASAP, and am willing to pay for it. If you're interested in making this work, please PM me or shoot me an email via the contact form at https://www.pixelscrapper.com/contact
Comment #46
jurriaanroelofs commentedI got PayPal working with the module, we did a big push on development with the module in this repo so the codebase should largely be the same. The partner that worked on this was InternetDevels so you can ask them for support and integration. https://internetdevels.com/
I'm attaching a copy of my module with no guarantees as to whether it will work, I have no idea what development has happened in this repo since we moved the work forward ourselves to run on sooperthemes.com.
I use it together with the recurlyjs and recurly roles module.
Comment #47
markdorisonThere were quite a bit of changes in the module repo which were not encompassed in the attached zip file. I have tried to limit the diff by excluding what I could identify as changes that had been made in the repo. If I made a mistake, we will have to go back and re-examine the zip in #46.
With that said, there are still many unrelated changes in this patch, specifically in the CSS and JS files. If this is to be pushed forward, someone needs to pick apart what is new and what is relevant exclusively to PayPal support.
Comment #48
jordanmagnuson commented@markdorison: thanks for working on this!
After applying the patch I'm getting the following error on the recurly checkout page:
Error: Call to undefined function _recurlyjs_get_countries() in _recurlyjs_append_billing_fields() (line 662 of /var/www/pixelscrapper.com/public_html/sites/all/modules/recurly/modules/recurlyjs/includes/recurlyjs.pages.inc).(screenshot: https://i.imgur.com/zUpzHZZ.png)
If I comment that section of code out, I then get this error:
Error: Call to undefined function _recurlyjs_append_paypal_payment_method() in recurlyjs_subscribe_form() (line 150 of /var/www/pixelscrapper.com/public_html/sites/all/modules/recurly/modules/recurlyjs/includes/recurlyjs.pages.inc).Comment #49
markdorisonI have given the enormous patch in #47 another pass and removed more of what I believe are extraneous pieces of the diff. This is attached, but I believe much more needs to be removed and I can no longer invest time in this approach.
That said, I am increasingly convinced that the patch I created will not easily be moved forward. There is simply too much unrelated code that has been included and I don't have the free time available to pick it apart. If someone does, an alternative approach would be to analyze the code from the ZIP in #46 to understand the PayPal implementation and attempt to manually re-implement them on
7.x-3.x.I would love to see this pushed forward, and would be happy to review future clean patches made off the HEAD of
7.x-3.x.Comment #50
jurriaanroelofs commentedHi mark, it's been a couple of years since we started working on the recurly contrib module but most of what we added, and what I see in the patch, is the implementation of RecurlyJS form validation and styling. All the code was based on the RecurlyJS examples, like this one:
https://github.com/recurly/recurly-js-examples
It's too long ago for me to remember exactly what examples and documentation this is based on but if I'm correct you should see an improvement in automatic form validation on the recurlyJS form from this patch. Unless you also developed this separately from us and that's already in the repo.
Wish I had time to help.
I see many big websites use Drupal and recurly, strange there is not more help coming from them.
Comment #51
kcannick commentedHey guys, I added Paypal support to the module and had issue getting it to work until I realized that recurly client php library needed to be updated. The version that worked with 2.x version of module doesn't retrieve Recurly account object by token. Hope this helps.
SIDENOTE: Recurly is a horrible company to use for SMBs. If you're not an enterprise company they don't really care. I highly regret using them. I suggest using stripe or braintree instead.
Comment #52
colan#51: Yes, this is an aside, but any thoughts on Fusebill? There are no modules for some of these other providers, which is probably why most of us went with Recurly. But as a community, we should start developing other modules to work with other services if they're good alternatives. (I'm mostly interested in figuring out possible vendors for Aegir Site Subscriptions.)
Comment #53
jordanmagnuson commentedI'm still willing to sponsor/pay for a proper patch adding PayPal support to the current 7.x-3.x version of the Recurly module. (Still disappointed that this functionality was mysteriously lost between the 2.x and 3.x versions of this module.)
If anyone is interested in working to get this done, please PM me and/or shoot me an email via the contact form at https://www.pixelscrapper.com/contact
Comment #54
jordanmagnuson commentedOkay, I have gone back to the drawing board and created a new patch from scratch that adds basic PayPal support to the 7.x-3.x version of the RecurlyJS module. This builds on the work of nvhcuong in #32, and documentation at https://dev.recurly.com/docs/recurly-js-paypal .
The patch adds a simple radio option to the subscription form for payment method (credit card or PayPal), and shows/hides the credit card fields and PayPal checkout button accordingly. This radio option only shows up if "allow PayPal checkout" is enabled in the RecurlyJS module admin settings.
No fancy css or styling, but users can easily apply their own css to turn the radio buttons into tabs, etc. if desired.
Screenshots:
I have been running the patch successfully on a large production site for over a week now without any obvious problems.
Let's please get this reviewed and applied so that we can finally close this issue!
Comment #55
colanSounds good! We're going to need to get something in for Drupal 8 as well.
Comment #56
jurriaanroelofs commentedHello Jordan, I think there are some issues with your PayPal implementation, unless I misunderstand the process:
I'll try to make a patch today that solves some of the issues mentioned.
Comment #57
jurriaanroelofs commentedI asked Recurly support and apparently there is more working involved in getting billing info with PayPal based accounts, not sure why it has to be this complicated..
Comment #58
jordanmagnuson commented@JurriaanRoelofs: The patch was not designed to collect address information from PayPal customers. Collecting address information from PayPal customers is not Recurly's default behavior (see the screenshots at the top of this page from Recurly's own hosted checkout pages -- the PayPal checkout just sends the user to PayPal, which is what this patch does using recurly.js, based on documentation at https://dev.recurly.com/docs/recurly-js-paypal):
The patch would need to be modified for people wanting to additionally collect address information from PayPal customers (but please make sure we maintain options for this in the admin interface, for people who do NOT want to collect address information).
I have been using the patch in #54 on a large production site (500k+ pageviews/mo) for several months now, without issue, so my recommendation is that:
1) The patch in #54 is committed, as it does provide basic PayPal integration via recurly.js which is consistent with Recurly's hosted pages PayPal integration.
2) We create a new issue for adding additional functionality like address collection, for those who want it.
This particular issue has been open for way too long. We should commit the patch and close the issue and create new issues as needed/desired.
Comment #59
jordanmagnuson commentedMarking #54 as RTBC based on my experience running it on a large production site for several months now without issue.
#54 is a very basic patch. Please let's commit this, then open new issues to build additional functionality, so that we don't keep losing forward progress. This issue is over FIVE YEARS old!
Comment #60
jurriaanroelofs commentedRight now it breaks Recurly's default behaviors related to calculating sales tax. Recurly uses the postal code and country fields to calculate tax so you shouldn't remove them.
If you really want to remove these fields for a quicker checkout you can do so after retrieving the RecurlyPlan and checking that plan.tax_exmpt property = false.
Today I'm working on a patch that adds support for Recurly addons, I'll also try to update this patch so that it won't break Recurly's tax calculation.
Comment #61
jordanmagnuson commentedThe patch in #54 does not remove any fields. Sales tax calculation is not enabled in Recurly by default, and neither is address collection for PayPal payments.
Sales tax calculation did not even exist in Recurly until relatively recently (a long time after this issue was created!), and depending on what you are selling and where you are selling it (esp. digital goods), this functionality may or may not be required (or it can be handled on a separate layer).
The patch in #54 adds default PayPal processing via Recurly.js as indicated in Recurly's documentation at https://dev.recurly.com/docs/recurly-js-paypal .
IMHO, address collection for Recurly.js PayPal payments should be addressed in a separate issue, such as: "Add sales tax / address collection support to Recurly.js PayPal payments."
Otherwise this just goes on and on, and eventually work that was done to solve part of the problem is lost, and then we have to start all over again.
Just my two cents. (I agree with you, JurriaanRoelofs, that this functionality should be added. I just think it could happen in a separate issue thread.)
Comment #62
colanFixing tag.
Comment #63
jordanmagnuson commentedJust putting in my plea once more that the patch in #54 be committed to the D7 branch, before all the work is lost. See comments in #58 and #61.
The patch in #54 works. It has been in use on a large production site for two years now. It adds basic, default PayPal support to RecurlyJS.
Why can't we just commit this, and open new issues for followup/adding additional features?
If others disagree, they can of course change status, etc. But wanted to poke this issue again, because it has been here for way too long without resolution.
Comment #64
colan#63: While I'm semi-actively maintaining the D8 branch, I'm not interested in maintaining the D7 one. And there doesn't appear to be an active D7 branch maintainer currently. If you'd like to volunteer, I'll happily make you a maintainer.
Comment #65
jordanmagnuson commented@colan: I'd be willing to help maintain the D7 branch. My company relies on both Drupal 7 and Recurly, and that's likely to be true for a while yet.
Comment #66
colan@JordanMagnuson: Congratulations! You're now a maintainer. Thanks for offering to get D7 cleaned up.
Comment #67
colanComment #68
jordanmagnuson commentedOkay, thanks. I will try to get some of these patches applied in the next few weeks. Cheers.
Comment #69
loze commentedI would like to 2nd that I have been running this on two production sites for several years with no issues.
I'm currently working on migrating them to D8 and will provide a patch shortly.
Comment #70
loze commentedHere is a patch with the same changes in #54 for D8. Should I start a new issue for this?
@JordanMagnuson Maybe i missed it in the conversation above, but I'm wondering if there is a particular reason for adding the paypal submit input button as #markup instead as a normal form element. Is this so it doesn't validate the main form when clicked? Is there a better way to do that?
Comment #71
loze commentedComment #72
colanMay as well keep it here as folks have lost interest in D7. Fixing status as RTBC was for D7 (which the D7 maintainer can still commit).
Comment #73
jordanmagnuson commentedSorry for being MIA. Crazy last few months (as I'm sure it has been for many). I am still using the D7 version of this module, and still plan to commit the patch when I, quote, have a moment. :\
@Ioze: I would imagine there was a reason for the #markup choice, but I can't remember offhand why this was chosen over a normal form element.
Comment #75
jordanmagnuson commentedOkay, I have committed the patch in #54 to the 7.x-3.x dev branch! (With a couple of slight adjustments).
Comment #76
jordanmagnuson commentedI just committed the accepted patch to the 7.x-3.x branch, and am marking this issue as fixed. I think a separate issue should be started for a D8 forward port, as was done for [D8] Support 3D-Secure / PSD2 / SCA.
Justification:
Others can obviously weigh in, but it seems like best practice should be:
Comment #77
colanMight be simpler to just do this?
Comment #78
jordanmagnuson commented@colan: up to you. I really think it makes more sense to open a new issue once a patch is committed to one branch, as the amount of time it will take to patch the other branch(es) is indeterminate, and people should get credit for a patch that was applied to any branch (which can only happen if the issue is marked as fixed). Especially for an issue like this that has been open for several years.
Another reason is that it is not immediately evident when looking through the issue queue which fixes have been applied to which branches. If you see an open issue like this, titled, "Add RecurlyJS PayPal support", with dozens of replies, with version 8.x-1.x-dev, it is not immediately clear if the issue is still open for 7.x and 8.x, or if it has already been fixed in 7.x: you have to scroll through the comments and try to find the relevant commits and comments.
By contrast, if this issue is labeled "[D7] Add RecurlyJS PayPal support" and marked as fixed, with another open issue labeled "[D8] Forward Port: Add RecurlyJS PayPal support", and the issues are linked, it is immediately clear what the situation is: something has been fixed in the 7.x branch, but still needs a forward port to the 8.x branch.
And a final reason, again, is that combining issues that are in different states for different branches makes it difficult to track release targets for a given branch, as we are trying to do in Plan for Recurly 7.x-3.1 release. You can see that in our list of issues there, this issue is still indicated as open, since you re-opened it--even though it has been fixed for our branch.
If we want to keep this issue open, I will probably create a dummy issue to mark as fixed so that we can track it properly for our 7.x-3.1 release goals, and so that people can get well-deserved credit for helping with the D7 patch.
Just my two cents.
Comment #79
colanYou convinced me, especially with the credit point. But let's at least open new issues before marking these as fixed. Otherwise, they could close before anybody creates the new ones, and those threads are lost.
Comment #80
jordanmagnuson commentedGood point. Okay, I've created an issue for the D8 forward port here: https://www.drupal.org/project/recurly/issues/3205884
@Ioze: please add your proposed D8 patch to that issue when you get a chance.
Comment #81
loze commentedAdded patch in #70 to the new issue.