Copied to clipboard

Flag this post as spam?

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


  • Gordon Saxby 1444 posts 1855 karma points
    May 17, 2019 @ 08:30
    Gordon Saxby
    0

    Basket not cleared after Stripe payment

    I have the Stripe payment provider working OK, but after each successful payment, the basket still contained the ordered items.

    Is that something the payment provider should handle (empty the basket) or should I?

    I am also using the Invoicing payment provider and that does clear the basket.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    May 17, 2019 @ 08:48
    Matt Brailsford
    0

    Hey Gordon,

    Is the order appearing in the back office as a finalized order? It sounds like the callback might not be firing that that finalizes the order.

    Matt

  • Gordon Saxby 1444 posts 1855 karma points
    May 17, 2019 @ 08:52
    Gordon Saxby
    0

    The orders are appearing in TC - Order Status = New, Transaction state = Captured.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    May 17, 2019 @ 08:53
    Matt Brailsford
    0

    Interesting. Then yea, the basked should have been emptied.

    Is there any errors in the log file?

  • Gordon Saxby 1444 posts 1855 karma points
    May 17, 2019 @ 08:59
    Gordon Saxby
    0

    Messages in the log, eg "INFO TeaCommerce.Api.Models.Order - Order finalized - OnFinalized finished." - but no errors.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    May 17, 2019 @ 09:09
    Matt Brailsford
    0

    Hmm, then I can't see any reason why it wouldn't get cleared. Especially if the invoice payment method is clearing. If the payment provider code finished successfully, then the same internal code should be running to clear the order 🤔

  • Gordon Saxby 1444 posts 1855 karma points
    May 17, 2019 @ 09:23
    Gordon Saxby
    0

    The same happens on my local dev environment and our staging server (same code version), and it happens for everyone. So, it's not a peculiar thing with my setup.

    So, is the basket cleared in code internal to TeaCommerce?

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    May 17, 2019 @ 09:54
    Matt Brailsford
    0

    Hey Gordon,

    Yea, it is.

    Essentially we have a SessionManager that stores keys in the session / cookie. When you request info from the session (ie, the current order) it first checks if things have changed and if so updates those id's, so on the finalize order screen when you fetch your finalized order, it should really have cleared out the "currentOrderId".

    Does the cart you are seeing belong to the order that was processed do you know? (ie, are they the same order id?) or has it replicated the cart?

  • Gordon Saxby 1444 posts 1855 karma points
    May 17, 2019 @ 10:08
    Gordon Saxby
    0

    I made an order and the order number was ORDER-34, its reference-id was CART-75.

    I then immediately made another order with the basket as it was (same content as before). Order number was ORDER-35 and its reference-id CART-76.

    I'm not sure if that helps?!

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    May 17, 2019 @ 10:11
    Matt Brailsford
    0

    Hmm, the only way I know that an order gets "cloned" is if you attempt to modify it when it's mid payment processing. I don't suppose you have any events that are triggering and modifying the order as it's being processed?

  • Gordon Saxby 1444 posts 1855 karma points
    May 17, 2019 @ 10:17
    Gordon Saxby
    0

    These are all of the event handlers we use:

            NotificationCenter.Order.OrderLinesAdding += Order_OrderLinesAdding;
            NotificationCenter.Order.OrderLinesUpdating += Order_OrderLinesUpdating;
            NotificationCenter.Order.OrderLinesRemoved += Order_OrderLinesRemoved;
            NotificationCenter.Order.Finalized += Order_Finalized;
            NotificationCenter.Order.GiftCardsAdded += Order_GiftCardAdded;
            NotificationCenter.EmailTemplate.MailSending += EmailTemplate_MailSending;
    

    They have all been in place for a long time though and none have been altered during the Stripe integration work.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    May 17, 2019 @ 10:23
    Matt Brailsford
    0

    Hmm, they look ok to me.

    If you have the store with cookies enabled, maybe review the cookie pre and post checkout to see what it contains. With cookies enabled, this should contains ID's for the current order / current finalized order etc.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    May 17, 2019 @ 10:34
    Matt Brailsford
    0

    As a quick solution, you might be able to try removing the current order within your finalized handler

    TC.RemoveCurrentOrder( storeId );
    
  • Gordon Saxby 1444 posts 1855 karma points
    May 17, 2019 @ 11:22
    Gordon Saxby
    0

    Not sure if / how this helps, but I recorded the cookie during 2 successive orders without altering the basket (it retained the first ordered product):

    First order, on Payment Page:
    
        currentShippingMethodId=5&currentOrderId=&currentPaymentCountryId=3&currentPaymentCountryRegionId=&currentShippingCountryId=3&currentShippingCountryRegionId=&currentPaymentMethodId=10007&currentPaymentProcessingOrderId=fe0c7a54-0d5b-48db-92e7-f0f5e45809c9
    
        First Order, Confirmation page:
    
        currentShippingMethodId=5&currentOrderId=4a759852-076c-48f8-a494-4944f3d9b7aa&currentPaymentCountryId=3&currentPaymentCountryRegionId=&currentShippingCountryId=3&currentShippingCountryRegionId=&currentPaymentMethodId=10007&currentPaymentProcessingOrderId=&currentFinalizedOrderId=fe0c7a54-0d5b-48db-92e7-f0f5e45809c9
    
        Straight back to Basket page:
    
        currentShippingMethodId=5&currentOrderId=4a759852-076c-48f8-a494-4944f3d9b7aa&currentPaymentCountryId=3&currentPaymentCountryRegionId=&currentShippingCountryId=3&currentShippingCountryRegionId=&currentPaymentMethodId=10007&currentPaymentProcessingOrderId=&currentFinalizedOrderId=fe0c7a54-0d5b-48db-92e7-f0f5e45809c9
    
        Second order, on Payment Page:
    
        currentShippingMethodId=5&currentOrderId=&currentPaymentCountryId=3&currentPaymentCountryRegionId=&currentShippingCountryId=3&currentShippingCountryRegionId=&currentPaymentMethodId=10007&currentPaymentProcessingOrderId=4a759852-076c-48f8-a494-4944f3d9b7aa&currentFinalizedOrderId=fe0c7a54-0d5b-48db-92e7-f0f5e45809c9
    

    Shouldn't the cookie be cleared by the time we arrive at the confirmation page?

    I think I will need to force a basket empty in code!

  • Gordon Saxby 1444 posts 1855 karma points
    May 17, 2019 @ 11:31
    Gordon Saxby
    0

    That seems to have fixed the issue. Fingers crossed!! :-)

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    May 17, 2019 @ 12:04
    Matt Brailsford
    0

    That's some really useful info thanks. I'll try and look into this a little more closely, but yes, once you are on the confirmation page and you call GetCurrentFinalizedOrder that really should be triggering the clearing of the previous order.

    Glad you've got something to work never the less.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    May 17, 2019 @ 12:10
    Matt Brailsford
    0

    Question, can you share what code you have on your confirmation page? Mostly where you interact with TC

  • Gordon Saxby 1444 posts 1855 karma points
    May 17, 2019 @ 12:14
    Gordon Saxby
    0

    Can I email it to info at teacommerce dot net?

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    May 17, 2019 @ 12:16
    Matt Brailsford
    0

    Of course 👍

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Jul 23, 2019 @ 10:24
    Matt Brailsford
    0

    Just to add the answer to this post, Gordon sent me the source for his project and it turned out there was some rogue JS attempting to modify an order post finalization which when this occurs via the TC. api, this clones the order and sets it as the current order (it does this to prevent editing an order once it's been sent to payment process).

    We are looking at options to only do this in certain cercumstances (I think it only really makes sense if the transaction is canceled / errored, otherwise I think an error should be thrown.

    I will see what I can come up with to resolve this, but in the meantime, the fix here is to make sure you aren't modifying an order after it has been finalized.

Please Sign in or register to post replies

Write your reply to:

Draft