Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stripe API not working as expected: latests versions not supported? (unable to deserialize payload. Expected version 2020-08-27, actual 2022-11-15) #1159

Closed
icougil opened this issue Dec 18, 2022 · 3 comments
Assignees

Comments

@icougil
Copy link

icougil commented Dec 18, 2022

Describe the bug
After following the steps described here and after creating the corresponding webhook in Stripe, it seems that Alf.io is not working as expected with Stripe API and therefore the payments are not confirmed as expected 😞.

I guess the alf.io uses the 2020-08-27 version of the Stripe API (I guess that is because the main activity that appears in Stripe is from that version). The issue is that Stripe does not offer you this version anymore when you create a webhook in Stripe 🙁. Therefore, I've tried the 2 other API versions you can choose (2022-08-01 or 2022-11-15) but without luck 😥

This is the stacktrace we saw in the log file once we proceed to pay:

2022-12-18 17:32:05.795 [qtp2113919627-947] WARN alfio.manager.payment.StripeWebhookPaymentManager - unable to deserialize payload. Expected version 2020-08-27, actual 2022-11-15, falling back to unsafe deserialization
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.3.18.jar:5.3.18]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783) ~[spring-aop-5.3.18.jar:5.3.18]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.3.18.jar:5.3.18]
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.5.5.jar:5.5.5]
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.5.5.jar:5.5.5]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.5.5.jar:5.5.5]
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.5.5.jar:5.5.5]
at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:179) ~[jetty-server-9.4.45.v20220203.jar:9.4.45.v20220203]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-server-9.4.45.v20220203.jar:9.4.45.v20220203]
at org.eclipse.jetty.server.Server.handle(Server.java:516) ~[jetty-server-9.4.45.v20220203.jar:9.4.45.v20220203]
at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487) ~[jetty-server-9.4.45.v20220203.jar:9.4.45.v20220203]
(...)
2022-12-18 17:32:05.809 [qtp2113919627-947] ERROR alfio.manager.payment.StripeWebhookPaymentManager - Error while trying to confirm the reservation
java.lang.NullPointerException: Cannot invoke "com.stripe.model.ChargeCollection.getData()" because the return value of "com.stripe.model.PaymentIntent.getCharges()" is null
at alfio.manager.payment.StripeWebhookPaymentManager.processSuccessfulPaymentIntent(StripeWebhookPaymentManager.java:318) ~[classes/:?]
at alfio.manager.payment.StripeWebhookPaymentManager.processWebhook(StripeWebhookPaymentManager.java:285) ~[classes/:?]
at alfio.manager.payment.StripeWebhookPaymentManager$$FastClassBySpringCGLIB$$92259e9b.invoke(<generated>) ~[classes/:?]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753) ~[spring-aop-5.3.18.jar:5.3.18]
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) ~[spring-tx-5.3.18.jar:5.3.18]
(...)
2022-12-18T18:35:00+01:00 2022-12-18 17:35:00.458 [qtp2113919627-928] WARN alfio.manager.payment.StripeWebhookPaymentManager - unable to deserialize payload. Expected version 2020-08-27, actual 2022-11-15, falling back to unsafe deserialization
2022-12-18T18:35:00+01:00 2022-12-18 17:35:00.463 [qtp2113919627-928] WARN alfio.manager.TicketReservationManager - discarding transaction webhook payment_intent.succeeded for reservation id ee70d21e-6ad3-4fb2-a399-c42eefa021ea (CANCELLED). Transaction status is: COMPLETE
2022-12-18T18:41:03+01:00 2022-12-18 17:41:03.750 [qtp2113919627-897] WARN alfio.manager.payment.StripeWebhookPaymentManager - unable to deserialize payload. Expected version 2020-08-27, actual 2022-11-15, falling back to unsafe deserialization
2022-12-18T18:41:03+01:00 2022-12-18 17:41:03.755 [qtp2113919627-897] WARN alfio.manager.TicketReservationManager - discarding transaction webhook payment_intent.succeeded for reservation id b3c64cdd-64a9-456b-99b5-f437479a76cc (CANCELLED). Transaction status is: COMPLETE

To Reproduce
Steps to reproduce the behavior:

  1. Configure the Stripe API keys
  2. Configure the webhook (with any of the API versions Stripe offers you)
  3. Configure alfio with your corresponding Stripe keys
  4. Try to pay a simple ticket
  5. See the error

Expected behavior
The payment is confirmed and the user arrives to the last page where he/she can see the payment was confirmed properly.

Screenshots
Here you can see what the users will see on the last step:
image
Yes, there is a solution right now, if the users "force the check" of the payment. In that case yes, they will see the final confirmation message. The question is, what if they don't press the button? They will end up communicating with the organizers and of course, this could make a lot of trouble...

Lastly, if the users don't do anything, the result will not be satisfactory at all 🙁 :
image

Also here you can see the logs from the Stripe dashboard, where apparently Stripe notifies that the encoding is not correct:
Invalid encoding: ISO-8859-1
image

Desktop:

  • OS: maOS
  • Browser: Chrome
  • Version: latest

Additional context
N/A

@syjer syjer added the payment label Dec 18, 2022
@cbellone
Copy link
Member

Hi @icougil,

the issue has been reported already from other people, but we haven't been able to reproduce it on our test account so far. It might be related only to live charges on newly created accounts.

Can you please share with us an anonymized version of the payload giving the error? You can see it on the stripe webhook log.
You can share it here or - if you feel more confortable - via email to info at alf.io

thank you in advance for your help

@cbellone cbellone added the bug label Dec 18, 2022
@icougil
Copy link
Author

icougil commented Dec 18, 2022

@cbellone I'll send you now an email with the entire payload, in order to help you dealing with this issue in the easiest way

@cbellone cbellone self-assigned this Dec 21, 2022
cbellone added a commit that referenced this issue Dec 21, 2022
cbellone added a commit that referenced this issue Dec 21, 2022
* create reproducer for #1159

* update Stripe API to 2022-11-15, handle events coming from older API version

* remove unused import

* fix typo
@icougil
Copy link
Author

icougil commented Dec 23, 2022

Thank you @cbellone and all the team!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants