Stipe webhook endpoint is rejected due to API version
Stipe orders are not finalized after upgrading to TC 3.3.1, related to en Stripe webhook error.
I have set up a webhook endpoint using Stripe API version 2019-08-14, but it looks like I have to use the API version 2019-05-16. The proble is that the API version 2019-05-16 is no longer an in my Stripe dashboard when adding a webhook endpoint . Is it possible to make the API version an option in the Tea Commerce pyment provider setup for Stripe?
Error message:
"Stripe.StripeException: Received event with API version 2019-08-14, but Stripe.net 3.1.7114 expects API version 2019-05-16. We recommend that you create a WebhookEndpoint with this API version. Otherwise, you can disable this exception by passing throwOnApiVersionMismatch=false to Stripe.EventUtility.ParseEvent or Stripe.EventUtility.ConstructEvent, but be wary that objects may be incorrectly deserialized.
at Stripe.EventUtility.ParseEvent(String json, Boolean throwOnApiVersionMismatch)"
Just to let you know, I've started development on this and have created a pull request for it on the Payment Providers GitHub repository. Still some testing to do, but if you wanted to try it out, I'd be glad of the feedback.
There will be yes. The PR here https://github.com/TeaCommerce/Tea-Commerce-Payment-Providers/pull/31 should be usable if you wanted to compile it and use it yourself if you are concerned about time. If it is built against the version of the API your Stripe account is configured to use then it will all be fine.
I'm currently just waiting on a response from Stripe as I'm concerned there may be issues with them constantly updating the webhook endpoints such that it breaks the provider if you aren't on the specific provider built against a specific webhook version. We don't really want to be having version specific releases of the provider.
Ok, as a bit of an update. I've spoken to Stripe and now know what we need to do to get it working.
Ultimately, we need the payment provider to register the webhook endpoint automatically, rather than having people register them manually. By registering them via code, it can explicitly pass an API version to use and so it ensures it's always notified using the specific API version.
I noticed a small error in the Stripe payment solution. If you submit the wrong CVC code and then resubmit with the correct CVC , I get a system error:
> ERROR TeaCommerce.Api.Web.FormPostHandler - FormPost error --- Form
> data: -- RemoveOrderLine = "orderLineId : orderLineId" -- storeId =
> "2" -- orderLineId = "696"
>
> System.Data.SqlClient.SqlException (0x80131904): Violation of PRIMARY
> KEY constraint 'PK_TeaCommerce_CustomProperty'. Cannot insert
> duplicate key in object 'dbo.TeaCommerce_CustomOrderProperty'. The
> duplicate key value is (958cdd55-4cc8-46a8-a9e5-e9cdeb185600,
> stripePaymentIntentId). The statement has been terminated.
After this has occurred, it is impossible to submit the order, and it is not possible to empty the shopping cart either. Have to delete TC cookies and add item to cart again.
Apart from this, everything seems to be working properly :)
This also happens if a customer double-click the payment form submit button (It takes a few seconds after clicking, so an impatient customer often clicks again), The first click goes through, while the second fails and the order is not approved, but the payment goes through. Maybe the button should be disable for a few seconds after the first click?
RE disabling the button, we do provide placeholders for code to do this (and recently added template code to do this) however as people modify this code it tends to be up to the implementer to ensure the button becomes disabled.
Stipe webhook endpoint is rejected due to API version
Stipe orders are not finalized after upgrading to TC 3.3.1, related to en Stripe webhook error.
I have set up a webhook endpoint using Stripe API version 2019-08-14, but it looks like I have to use the API version 2019-05-16. The proble is that the API version 2019-05-16 is no longer an in my Stripe dashboard when adding a webhook endpoint . Is it possible to make the API version an option in the Tea Commerce pyment provider setup for Stripe?
Error message: "Stripe.StripeException: Received event with API version 2019-08-14, but Stripe.net 3.1.7114 expects API version 2019-05-16. We recommend that you create a WebhookEndpoint with this API version. Otherwise, you can disable this exception by passing
throwOnApiVersionMismatch=false
toStripe.EventUtility.ParseEvent
orStripe.EventUtility.ConstructEvent
, but be wary that objects may be incorrectly deserialized. at Stripe.EventUtility.ParseEvent(String json, Boolean throwOnApiVersionMismatch)"Hey Arne,
Thanks for the detailed info.
I think with the SCA changes from Stripe is causing some rapid updates to their API. Hopefully it's just a case of updating the DLL.
I'll get this looked into next week and see if we can't get it updated.
Matt
Hey Arne,
Just to let you know, I've started development on this and have created a pull request for it on the Payment Providers GitHub repository. Still some testing to do, but if you wanted to try it out, I'd be glad of the feedback.
https://github.com/TeaCommerce/Tea-Commerce-Payment-Providers/pull/31
Many thanks
Matt
Sounds good, thank you very much
Hi Matt
Will there be a TC version 3.3.2 in time for the SCA changes on September 14?
Hi Arne,
There will be yes. The PR here https://github.com/TeaCommerce/Tea-Commerce-Payment-Providers/pull/31 should be usable if you wanted to compile it and use it yourself if you are concerned about time. If it is built against the version of the API your Stripe account is configured to use then it will all be fine.
I'm currently just waiting on a response from Stripe as I'm concerned there may be issues with them constantly updating the webhook endpoints such that it breaks the provider if you aren't on the specific provider built against a specific webhook version. We don't really want to be having version specific releases of the provider.
Matt
Ok, as a bit of an update. I've spoken to Stripe and now know what we need to do to get it working.
Ultimately, we need the payment provider to register the webhook endpoint automatically, rather than having people register them manually. By registering them via code, it can explicitly pass an API version to use and so it ensures it's always notified using the specific API version.
I've added some notes to the PR about what this ultimately means / involves https://github.com/TeaCommerce/Tea-Commerce-Payment-Providers/pull/31#issuecomment-525426739
I need to do some more testing before release, but hopefully this will resolve the issue.
Matt
Ok, I've released a new version of TC with the updated Stripe provider in it https://our.umbraco.com/packages/website-utilities/tea-commerce/
Please read the docs on the Stripe provider as how it is setup has changed https://docs.teacommerce.net/3.3.2/payment-providers/stripe/#configure-stripe
Thank you :)
I noticed a small error in the Stripe payment solution. If you submit the wrong CVC code and then resubmit with the correct CVC , I get a system error:
After this has occurred, it is impossible to submit the order, and it is not possible to empty the shopping cart either. Have to delete TC cookies and add item to cart again.
Apart from this, everything seems to be working properly :)
Shoot! You are right. I believe it's essentially this line that should be
AddOrUpdate
notAdd
https://github.com/TeaCommerce/Tea-Commerce-Payment-Providers/blob/master/Source/TeaCommerce.PaymentProviders.Stripe/Stripe.cs#L180
Damn it! I'll have to look at getting it recompiled and re-released 🤦♂️
I've recompiled the PaymentProviders DLL if you want to give this a try:
https://www.dropbox.com/s/lldps75zx6sz8am/TeaCommerce.PaymentProviders.dll.20190905.1356.zip?dl=0
Matt
This also happens if a customer double-click the payment form submit button (It takes a few seconds after clicking, so an impatient customer often clicks again), The first click goes through, while the second fails and the order is not approved, but the payment goes through. Maybe the button should be disable for a few seconds after the first click?
I will test
RE disabling the button, we do provide placeholders for code to do this (and recently added template code to do this) however as people modify this code it tends to be up to the implementer to ensure the button becomes disabled.
https://github.com/TeaCommerce/Tea-Commerce-Payment-Providers/blob/master/Source/TeaCommerce.PaymentProviders.UI/Views/Partials/StripePaymentForm.cshtml#L138
Matt
Ok, i understand about the button bocomes disabled.
Resending with corrected CVC seems to be working fine now, so the recompiled dll is working fine.
Thanks for the quick response.
Cool, thanks for testing.
I'll have to re-release TC again with a patch version, but the only difference will be that DLL so you shouldn't have to update it.
Matt
is working on a reply...