Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Karl Alesbury 8 posts 73 karma points
    Mar 14, 2024 @ 11:09
    Karl Alesbury
    1

    U13.0.3 / Commerce 13.1.1 - Stripe webhook going to error url, rather than continue url

    Hi,

    I've got Umbraco Commerce set up with stripe as the payment method, and I am successfully building a basket and going to Stripe with the correct amount to pay.

    In the Commerce Stripe configuration, I've set up a continue url, an error url, and have set up public key and secret key.

    I'm using the stripe CLI to forward all requests to https://{siteurl}/umbraco/commerce/payment/callback/stripe-checkout/{payment_id}/ where the payment ID is set up correctly as the stripe payment method. I've then added that webhook signing secret key to the payment method in commerce.

    When I complete payment, I can see in the stripe CLI that the webhook POSTs to this URL: https://{siteurl}/umbraco/commerce/payment/callback/stripe-checkout/c5d47d41-b23c-40a6-9d87-018c349f10cc/ [some value]

    and receives HTTP code 200.

    However, instead of going to the continue URL, the browser goes to the error URL, and the order is created in the back-office with the status of ERROR.

    Is there any way that I can debug why this might be the case? There are no errors in the Umbraco logs, and the customer's email address sees the error page, and receives a payment error email.

    There's also an added problem in that we are also using the Umbraco Commerce API to create orders programmatically, and that's also initially saving with the 'Error' status. Re-saving this order object, for some reason, sets the order to the correct status. The post that this bit relates to is here:

    https://our.umbraco.com/forum/using-umbraco-and-getting-started/113706-finalizing-umbraco-commerce-orders-result-in-orderstatus-error

    I'm stumped!

    Cheers,

    K

  • Karl Alesbury 8 posts 73 karma points
    Mar 26, 2024 @ 13:08
    Karl Alesbury
    101

    For anybody else that comes across this issue, our issue was because of the following:

    We use a ShippingCalculator to recalculate shipping prices, and we use a PriceAdjuster to recalculate tax on a product by product basis.

    Both of these things are called multiple times during the order calculation process, and what I didn't realise is that they are ALSO called AFTER Stripe payment, when the webhook is called.

    We had some legacy code in that webhook that referred to a HttpContext.Current.Identity.Name value, which won't resolve due to that property being null if called by a webhook.

    The PriceAdjuster was then failing silently, and the webhook was still returning HTTP code 200, and there was no nothing in the Umbraco logs.

    Hope this helps someone else in future.

Please Sign in or register to post replies

Write your reply to:

Draft