I just enabled 7.x-3.1 with the new php library and cannot get payments to go through. I keep getting this error in the Drupal logs (both uc_payment and uc_stripe)

Payment failed for order 11985: Stripe Charge Failed for order 11985: The payment Intent has failed.

I tried with several different cards. On the stripe side I see no errors in the log. The transaction is registered as a 200 Status.

I have successfully implemented 7.x-3.1 on a different site without these issues.

Any idea what might be happening?

Comments

bearstar created an issue. See original summary.

bearstar’s picture

The only factor that is different between the two sites is that Authorize.net was the previous method. (fyi, I also experienced that situation where Authorize.net failed to work when UC Stripe was enabled in the module list but not activated....separate issue)

andraeray’s picture

Hi,

I'm not quite sure what would be causing the problem.

In your stripe dashboard, when you click logs, then edit the filter to enable get methods is everything coming back as 200?
Also what is the result of the post to the paymentIntent there?

Then in your drupal logs, is there an error that comes before the "Payment Intent has Failed" error?

bearstar’s picture

Unfortunately, there is no additional error in the Drupal log....just the two pretty much identical errors:
uc_payment: Payment failed for order 11985: Stripe Charge Failed for order 11985: The payment Intent has failed.
uc_stripe: Stripe charge failed for order 11985, message: Stripe Charge Failed for order 11985: The payment Intent has failed.

On stripe, adding the GET filter shows no additional results. Everything is 200.

When I look at the individual transactions, I see no reference to paymentintent.

Do I need to setup a webhook? If so, what would the values be?

andraeray’s picture

Can you check the 200 response in Stripe and see the details, did stripe return a fail or a success? It should be in the status of the response.

Also, please double check to make sure your stripe api is using 6.38 or above.

Lastly check your console, F12 in the browser to see if you see a JS error.

andraeray’s picture

Also, you should be seeing posts to paymentIntent and paymentMethods in your stripe dashboard, if you aren't just check module and api version being used.

bearstar’s picture

Thanks for your help.
I am using 6.38
I am not seeing Paymentintents line items in the Stripe log....just payment methods
The Payment methods entries are 200, but they don't show success or fail line items.

I will re-enable Stripe and do another test and will report back about any js errors. I wonder if I should uninstall Authorize.net...?

bearstar’s picture

I re-enabled stripe and disabled Authorize.net and tried another transaction. There were no JS errors throughout the checkout.
The Stripe log doesn't show the paymentintent line items, only payment_methods

andraeray’s picture

This is very strange. I'm not sure what else to suggest. It sounds like it might be a problem specific to your site.

Could you possibly be using a test card in live mode? or vice versa?

andraeray’s picture

bearstar’s picture

Thank you for trying. If I figure it out I will post my solution.

cacaliban’s picture

I have the very same problem on my site with the same error codes both on drupal and stripe logs

cacaliban’s picture

Hi everybody,

I've also noticed these on the logs during the stripe process

Tipo php
Data Giovedì, Settembre 19, 2019 - 10:18
Utente cacaliban
Posizione https://www.laportamagica.it/it/uc_stripe/ajax/confirm_payment
Referrer https://www.laportamagica.it/it/cart/checkout/review
Messaggio Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (linea 175 di /web/htdocs/www.laportamagica.it/home/includes/entity.inc).
Rilevanza avviso
Nome host 2.35.181.69

Tipo php
Data Giovedì, Settembre 19, 2019 - 10:18
Utente cacaliban
Posizione https://www.laportamagica.it/it/uc_stripe/ajax/confirm_payment
Referrer https://www.laportamagica.it/it/cart/checkout/review
Messaggio Warning: key_exists() expects parameter 2 to be array, null given in _uc_stripe_confirm_payment() (linea 977 di /web/htdocs/www.laportamagica.it/home/sites/all/modules/uc_stripe/uc_stripe.module).
Rilevanza avviso
Nome host 2.35.181.69

I'm sorry I'm not into this so much and I cannot help so much

do you think it would be possible for me to go back to the preceding working version meanwhile?

thanks

andraeray’s picture

@cacaliban, sorry about the error. you can switch back to 2.2 if you need to. The safest way is to uninstall 3.1 then add 2.2 and enable, you'll have to reconfigure some settings.

By the way, have you changed from the default drupal JQuery?

andraeray’s picture

@bearstar have you changed the jQuery version from the default drupal one? If so, what version are you using?

cacaliban’s picture

@AndraeRay Thanks very much for your reply!

I've just installed jquery update (I'm not very skilled with these) and the results are that I should be on

jQuery Update jQuery 1.10.2 (configure) and jQuery UI 1.10.2

is this fine?

tried again with test mode but no changes, same errors both in drupal and stripe logs

I've no idea of what is not working, should better go back to 2.2?

again thanks very much for your help

andraeray’s picture

@cacaliban you do not need jQuery update. uc_stripe works with the normal Drupal jQuery.

It looks like your order data is empty for some reason based on the code you posted. What version of ubercart are you using?

cacaliban’s picture

@AndraeRay Ubercart 7.x 3.12, I'm receiving orders correctly with other payments (paypal too)

cacaliban’s picture

@AndraeRay I tried the rc versions too but nothing changed, now I came back to 2.2 and looks like everything works again. Unfortunately now I should have problems with the sca :(

If anybody should find a solution please post it (obviously I will do the same in the remote case I should arrive at a solution with my little knowledge)! Again thanks very much to all of you.

cacaliban’s picture

Hi everybody, by any chance is there any news about this matter?
I tried once again with the last ubercart update but I had the very same results.
Any idea for a possible solution or what could be the reason of it?
thanks a lot and best wishes for 2020!

andraeray’s picture

I haven't heard of anyone else having this issue.

Can you check your stripe dashboard to see the version of stripe library being used? You'll see something like this:
It's In developer > logs section as 'source'
Source: Stripe/v1 PhpBindings/6.38.0 Drupal Ubercart Stripe/dev-unknown (https://www.drupal.org/project/uc_stripe)

cacaliban’s picture

@AndraeRay thanks for your reply, it's a bit strange on stripe dashboard in the last log I have this
Origine Stripe/v1 PhpBindings/6.43.1
but on drupal looks like I have this
Stripe PHP Library Version 7.17.0
am I looking at two different things?

andraeray’s picture

Hrm.. Those should be matching. 6.38 is what we should be using.

How did you download the stripe php library?

Please go to sites/all/libraries/stripe and view the file named VERSION. What Version does it say?

cacaliban’s picture

I downloaded from github and followed your instructions uploading via ftp, maybe when I did it I thought using the latest version would have been fine. Do I have to use only the 6.38?

In any case, right now the file VERSION has only VERSION and no numbers. I can only read VERSION

Do you think I have to upload the 6.38 clear cache etc as per your instructions?

thanks very much

andraeray’s picture

Can you open the VERSION file? It will have a version number inside. It's really a text file.

Yes you can use 6.38 and see if your problem gets fixed.

cacaliban’s picture

first of all thanks for your help!
ok, the version was 7.17, now I'm back on 6.38 (via ftp and clearing cache) and changed with the latest stripe api
meanwhile I changed to php 7.2 (don't know if it could affect in some way)
I upgraded to the latest module 7x.3.2 and everything looks fine in the pane but unfortunately in test mode nothing goes through more or less with the same errors in drupal and 200ok on stripe dashboard :(

uc_payment 01/15/2020 - 12:55 Payment failed for order 3315: Stripe Charge Failed... cacaliban view order
uc_stripe 01/15/2020 - 12:55 Stripe charge failed for order 3315, message: Stripe... cacaliban
php 01/15/2020 - 12:55 Notice: Trying to get property 'status' of non-object... cacaliban
php 01/15/2020 - 12:55 Notice: Trying to get property 'status' of non-object... cacaliban
php 01/15/2020 - 12:55 Warning: array_flip(): Can only flip STRING and... cacaliban
php 01/15/2020 - 12:55 Notice: Trying to get property 'uid' of non-object in... cacaliban
php 01/15/2020 - 12:55 Notice: Trying to get property 'uid' of non-object in... cacaliban
php 01/15/2020 - 12:55 Warning: key_exists() expects parameter 2 to be array... cacaliban
php 01/15/2020 - 12:55 Notice: Trying to get property 'data' of non-object... cacaliban
php 01/15/2020 - 12:55 Notice: Trying to get property 'order_total' of non... cacaliban

andraeray’s picture

I'm glad to help. The setup of of this module should not be this hard. We are making some progress though. Those errors have been reported by people before, but I haven't gotten enough info to try to fix it.

Can you paste the full error messages it should say what lines of what files.

Also when you make a purchase can you open developer tools in your browser (F12) and see if there are any errors?

Can you message me through drupal? It's not letting me message you. Maybe we need a screen share or if you can provide me access to debug this.

cacaliban’s picture

As per the complete messages do you mean these?
Tipo php
Data Mercoledì, Gennaio 15, 2020 - 16:48
Utente cacaliban
Posizione https://www.laportamagica.it/it/uc_stripe/ajax/confirm_payment
Referrer https://www.laportamagica.it/it/cart/checkout/review
Messaggio Notice: Trying to get property 'order_total' of non-object in _uc_stripe_confirm_payment() (linea 1001 di /web/htdocs/www.laportamagica.it/home/sites/all/modules/uc_stripe/uc_stripe.module).

Rilevanza avviso
Tipo uc_payment
Data Mercoledì, Gennaio 15, 2020 - 16:48
Utente cacaliban
Posizione https://www.laportamagica.it/it/cart/checkout/review
Referrer https://www.laportamagica.it/it/cart/checkout/review
Messaggio Payment failed for order 3317: Stripe Charge Failed for order 3317: The payment Intent has failed.
Rilevanza avviso

as per the F12 yes I can, but I really don't know what looking for and where :(

for message you through drupal ok, but ... well I don't know how :(

and ok of course to give you access but I think you should register in my site?

again thanks very much!

andraeray’s picture

Thanks, for pasting the complete message. For some reason it doesn't seem to be able to pull up the order which is probably related to the error you are seeing.

I made an account on your site.

andraeray’s picture

Also, can you search for this string in your code?

drupal_add_js('misc/ajax.js'

This post mentions that a module adding this line can conflict with the Jquery ajax function.
https://www.drupal.org/project/jquery_update/issues/2034051#comment-9702023

cacaliban’s picture

thanks to Andrae, as far as I can see with my site, this particular issue is solved,
I think Andrae will better explain all the technical details later
again thanks Andrae and everybody on the forum

andraeray’s picture

Title: Payment Intent Has Failed » Payment Intent fails for translated sites with redirect

Thanks @cacaliban for testing.

I believe the original post of @bearstar is the same issue that @cacaliban has, so i'm updating the title.

Explanation of problem
Due to the use of Stripe PaymentIntent and the drupal server needing to check the status of the Stripe transaction with JS, There is a file in 3.x called uc_stripe_process_payment.js. The module makes a call to this file using ajax to get the status from Stripe.

On a non translate site the file can be accessed from:
yoursite.com/uc_stripe/ajax/uc_stripe_process_payment.js

On a translated site with url language prefix the file can be accessed from:
yoursite.com/en/uc_stripe/ajax/uc_stripe_process_payment.js (depending on your language prefix)

This module was trying to access the url without a language prefix all the time, and that triggers a redirect on some sites. The script never follows the redirect and causes a mysterious failure while retrieving this file. Which is why Stripe shows 200 and on the Drupal site we see an error with no cause.

I've tested a fix with @cacaliban.

andraeray’s picture

Now the module will check the pathPrefix variable and use it in the url if it is present.

Here is a patch of the fix.

  • AndraeRay committed b013dfe on 7.x-3.x
    Issue #3080730 by AndraeRay, cacaliban, bearstar: Payment Intent fails...
andraeray’s picture

Status: Active » Fixed

I have created a version 3.3 that has this fix.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

bearstar’s picture

Sorry for my absence. My client kept on with Authorize.net so this issue faded into the background. Now, we are back to wanting to use Stripe so I did the necessary updates:
Stripe module: 7.x-3.3
6.38 Stripe library
Latest API on Stripe

I am also set on Jquery 1.8 via Jquery update.
Authorize.net is still installed, but not selected.

Flushed caches.

The transaction still doesn't go through:
No errors in the console log.
Screen: We were unable to process your credit card payment. Please verify your card details and try again. If the problem persists, contact us to complete your order.
Log: Stripe charge failed for order 13335, message: Stripe Charge Failed for order 13335: The payment Intent has failed.
At Stripe, it shows the payment record in the logs, but no payment intent line items.

I do see that there is no /ajax/confirm_payment directory in /sites/all/modules/uc_stripe/

Not sure what else to look into...?

andraeray’s picture

@bearstar

Could you be facing this issue?

#3115669: uc_stripe is not compatible with "disable checkout review" It's where skipping checkout review causes an error.

bearstar’s picture

My site is using checkout review (not skipping it).
Is the /ajax/confirm_payment an actual directory or just some virtual thing? I ask because I don't see such a directory in /uc_stripe