We are running this module (2015-10-15) along with the card on file module and authorize.net.
Up until a couple months ago, everything was running smoothly. Things worked exactly like we wanted. During this time we may of upgraded/updated some of our code, but nothing that was specific to the recurring system. We did apply an update to the api end points for authorize.net to move to their new CDN.
All of a sudden we started having people get authorize/capture on their cards 4, 5 and 6 times. We started to reduce the number of entities the system would attempt to process and things did get better, but we are still seeing multiple charges per order.
Often what happens is we will see the charge in authorize.net, come to the site and not see the order. Cron runs again, we see the order created and a charge attempt on the order. This means that two charges have been done, but only the second charge is reflected on the order. In authorize.net we see two charges, both pointing to the same order id.
Has anyone experience something like this before? If not, does anyone have any suggestions on debugging this problem? Would this be better suited for the commerce_authnet module? or card on file module issue?
Another thing to note is we do have redis running on some of our cache_ tables.
| Comment | File | Size | Author |
|---|---|---|---|
| #31 | manual_payment_processing.zip | 3.27 KB | mrweiner |
| #4 | multiple-transactions-2649890-4.patch | 1.58 KB | Chim |
Comments
Comment #2
rgilkey commentedI'm experiencing this issue today with a site. Have you been able to identify root cause or get any feedback from other users?
Comment #3
rgilkey commentedI am experiencing this issue as well. We only experience the issue sometimes. It seems to happen when we get multiple hits to the site that attempt to kick off cron runs. I've started digging into the code, but have not found anything yet.
Has anyone identified the root cause or a solution?
Comment #4
Chim commentedThis patch may help.
There is a bug in the commerce_recurring_order_load_recurring_line_items function.
If it's called twice for two different orders then the second call returns the line items for the first call.
In the cron run it is called twice.
This is due to the drupal static call.
Also if the order line items change for the same order, then the unchanged line items are called.
For safety I think it's better that the line items are not cached.
Also this SQL may help identify if you have any customers who have been charged to frequently
Another issue could be deleting users with recurring entities, the recurring entities will still trigger transactions.
Comment #5
torgospizzaPeople being charged more than they should be seems like a Critical to me. Plus there is a patch for review.
Thanks, @Chim!
Comment #6
Chim commentedThanks torgosPizza I agree.
This is critical, we've been able to demonstrate that if two or more orders are processed on the same cron then only the first orders recurring entity is updated with a new due date.
There's another related ticket https://www.drupal.org/node/2075607, but... I think the patch above is a better solution as the other patch doesn't allow for changed line items on the same order.
That is, it still returns the cached originals.
This means that the next cron run will process all but the first again. An unlucky customer could be charged lots of times, if you run an hourly cron, then this could potentfially empty a users account or max out a user's credit card quite quickly.
Comment #7
Chim commentedComment #8
Chim commentedComment #9
Collins405 commentedThis is huge isnt it!? Shouldnt we notify people that the module is unsafe without this patch?
Or can we get this committed asap?
Comment #10
pcambraAgreed, this is a critical bug and let's get this in right in. Thanks a lot for reporting and fixing it @Chim!
It would be awesome if someone can produce a test for this.
Comment #12
Chim commentedThanks pcambra.
I'll have another go.
but I did notice that
testCommerceRecurringPurchaseTwoRecurringProducts passes now on the automated testing
Not sure if we can attribute that pass to this patch though
Comment #13
MichaelSt commentedI have a Drupal site with commerce card on file and authorize.net...
The site charged 3 customers about 7 times last night (once each hour) - it should have only charged them once each. Every time it charged them it kept setting their Due Date to "0 Seconds" and charging again. This seems like a big deal and and any guidance would be appreciated.
Thanks!
Comment #14
Collins405 commentedHave you applied the patch or updated the the dev version?
Comment #15
MichaelSt commentedMy code looks the same as the patch.
I'm running:
Card on File Recurring - 7.x-2.0-Beta5
Commerce Recurring - 7.x-2.x-dev
Authorize.net - 7.x-1.4
Thank you!
Comment #16
z-digital commentedExperiencing this issue as well. Multiple charges.
I'm running:
Card on File Recurring - 7.x-2.0-Beta5
Commerce Recurring - 7.x-2.x-dev
Stripe - 7.x-1.2+3-dev
Comment #17
z-digital commentedNot sure. May be part of this issue.
I am getting a warning on admin/commerce/recurring-entities/9/edit.
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'commerce_recurring_edit_product_form' not found or invalid function name in drupal_retrieve_form() (line 842 of ... /public_html/includes/form.inc).
Thanks!
Comment #18
g33kg1rl commentedThis should be mentioned in the description of the module as critical. I am upgrading to the dev version asap, but according to #15 and #16, it doesn't seem to be fixing the issue.
I have been authorized by my company to offer a $100 bounty to be split between whoever fixes this issue within the next 1 week. Bounty reduces to $50 if it takes longer.
Comment #19
pcambraPlease provide test cases and ways to reproduce this problem instead.
Comment #20
g33kg1rl commentedpcambra, thank you for responding so quickly. It is much appreciated.
I am using these modules:
Commerce Recurring Framework: Version: 7.x-2.x-dev
Card on File - Recurring: Version: 7.x-2.0-beta6+1-dev
Commerce Stripe: Version: 7.x-1.2
Using this patch for Card on File
https://www.drupal.org/node/2000420#comment-11593817
The rule, "Charge pending recurring orders", is the only recurring rule that is overridden in order to select Stripe as the payment method. (see link above)
Please let me know if you need any other information.
Comment #21
g33kg1rl commentedI have a testing server with a sandbox payment provider so I can test any patches provided.
Comment #22
pcambra@g33kg1rl it'd be very useful if you can give me access to that to see how to reproduce the issue.
Comment #23
g33kg1rl commented@pcambra, I sent you a PM.
Comment #24
g33kg1rl commentedSetting back to active
Comment #25
g33kg1rl commented@MichaelSt and @z-digital do either of you have more information about reproducing the issue? Maybe if we can find a common thread between our configuration.
Comment #26
facine commentedBased on my experience with payment gateways I think the error could be when making multiple requests, without a pause between them, some get time out closing the connection with the server before the response is received, creating a false negative in the payment and provoking that it is tried to make the payment again. As @Chim comment: if more than 1 order is processed, only the first one is updated correctly.
I do not know what method / module you are using to manage the payments, but would it be possible for someone to take the following test and tell us the result?
- Limit the number of payments to be processed to 2/3 every time.
- Add a delay between requests of 5/10 seconds.
This change should probably need to be made either in the payment gateway module or for example in the card on file integration -> https://www.drupal.org/sandbox/jpstrikesback/2260137
Comment #27
z-digital commentedg33kg1rl - just updated commerce_cardonfile_recurring to Version: 7.x-2.0-beta6 and am using commerce_recurring Version: 7.x-2.x-dev with commerce_stripe Version: 7.x-1.2+3-dev and 'Integration type' stripe js. I was using a friendly client to run a 'live' recurring monthly bill and his payment was triggered at checkout and then again the following day (same billing amount paid twice).
I applied the 'multiple-transactions-2649890-4.patch' about a year ago. Same result, payment was triggered at checkout and then again the following day. I have not used this recurring payment method since.
I'm not even sure I have the recurring products configured properly. I did watch "Commerce Recurring Framework Commerce Module Tuesday" by Augustin Delaporte (?) and went through the commerce recurring module description overview and issues sections.
I have my site on a dev sub-domain currently and was going to do some further testing. Sorry, I'm not a php coder.
If I can be of any help, please let me know.
Thanks in advance.
Comment #28
facine commented@z-digital, what method / module are you using to manage the payments?
Comment #29
z-digital commentedfacine - short answer is that my 'home' website relies on physical billing for services. I have built several websites that use commerce for products and commerce license for file downloads. I have used stripe as the gateway. I was just trying 'recurring products' and 'recurring billing' so that I can get away from my physical billing.
I have worked with drupal (I like it) to build mostly identity or brochure websites. Being self-taught, usually youtube has enough to get me past the issues I've had. Commerce however, doesn't really have the deeper (step-by-step) build training - not their fault.
Thanks for the follow-up and thanks again for the help.
Comment #30
deggertsen commentedI believe I was having this issue on a site, but if I remember correctly I was able to fix it by simply limiting the number of fetched entities to 2 in the Fetch entity by property for the "Charge pending recurring orders" rule. It seems like if I allowed more than than that many to process each time the Commerce Recurring cron is executed it would get hung up and wouldn't ever change the order status even if the payment went through. This would cause the same orders to pile up and get charged over and over and over again simply because the server couldn't seem to finish processing the rules. I'm pretty sure once I changed it so that it would only process 2 at a time the problem stopped happening.
Can anybody confirm if the patch here actually fixes this problem? It would be nice if we could process more than 2 orders in a cron run if necessary...
Comment #31
mrweiner commentedWe ran across this issue in a pretty serious way earlier this month where we had hundreds of orders running duplicate charges out of nowhere. I think some of it may have been related to not having enough memory provisioned, so if you do see this then you may want to try upping your memory limit.
I believe that the root cause may have something to do with orders being generate/charged but not saving correctly/being deleted afterward, causing a new pending order to be generated and charged again. While troubleshooting, I hit some out of memory errors while generating the "recurring pending orders" leading me to believe that the issue could be memory related. Unfortunately I didn't notice this until after solving the problem with the below method so YMMV.
We tried applying the patch above, as well as limiting the number of of orders as mentioned by @deggertsen, but that did not solve our problem. What we did to get around the issue was:
Some notes on the attached module:
We've got this module running on Prod now and have not experienced any further duplicate charges. I wish I could have posted an update with a patch or something, but hopefully this is just as functional.
Marking as "Needs Review" to alert maintainers to this workaround in case they'd like to implement something similar anywhere.
Comment #32
capellicI created a case and provided a patch to add the ability to hook into the function that sets the new due date so that I could take action if I saw that the data was suspicious. I recommend anybody who's having problems to look at #2995101: Ability to alter recurring entity or add monitoring code when extending values after successful recursion.
Comment #33
kingandyAm I right in thinking this bug is to do with the Commerce Cardonfile Recurring module that comes packaged with Commerce Cardonfile?