Copied to clipboard

Flag this post as spam?

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


  • anh-duc-le 36 posts 150 karma points
    Feb 20, 2023 @ 11:46
    anh-duc-le
    0

    SEPA Bank Transfer causes exception on return to website URL because Mollie payment status is still OPENRelated issue

    Error on "Continue to website"

    We are having an issue where when a customer decides to pay with a SEPA Bank Transfer, they're met with the following screen.

    From this screen they get the option to "Continue to the website" and that's where they will hit an internal 500 error.

    Screen the customer sees when choosing to pay with bank transfer

    The customer gets redirected to this URL:

    https://foobar.com/umbraco
    /vendr/payment/callback/mollie-onetime
    /5ca03059-97aa-44c1-bfc9-bb547ffedbd7
    /ORDER-01234-56789-ABCD6
    /5c5dac6f394b7020d31097023977e095f3f372f1
    ?redirect=true
    

    Which will throw an internal error on the https://foobar.com/checkout/order-confirmation page because the order with OrderNUmber ORDER-01234-56789-ABCD6 does not exist yet.


    No webhook

    The problem here is that Mollie keeps the Payment Status on OPEN until a bank transfer is made. Therefore no webhooks are called to Vendr to notify that the customer has chosen to make a SEPA bank transfer.

    Because of this we do not know when a customer chooses to pay by CC, direct transfer or SEPA bank transfer.

    What would be the solution here? Simply add an exception handler for when no matching vendrOrder can't be found for the orderNumber and show the customer a page that says:

    "Looks like this order with orderNumber has not been paid yet. Follow the instructions in your mailbox if you chose SEPA Bank Transfer payment option or contact customer support?"

    Sequence diagram of how I understand the SEPA bank transfer to work


    Related issue

    I have opened this in a new thread because I think this is a slightly different issue from the issue discussed here: https://our.umbraco.com/packages/website-utilities/vendr/vendr-support/109270-sepa-orders-not-finalized

    Once a payment has been transferred to Mollie, the paid webhook is called by Mollie and the order gets processed properly in Vendr.

    Our problem is only when the order hasn't been paid.

  • Matt Brailsford 4123 posts 22194 karma points MVP 9x c-trib
    Feb 20, 2023 @ 12:02
    Matt Brailsford
    1

    What exactly is the exception that is thrown?

    Your findings are correct by the looks of it. According to Mollie statuses (see https://docs.mollie.com/orders/status-changes) an order in Pending status won't fire a webhook as it means the order hasn't yet received funds.

    I think maybe we need to update something here https://github.com/vendrhub/vendr-payment-provider-mollie/blob/v2/dev/src/Vendr.PaymentProviders.Mollie/MollieOneTimePaymentProvider.cs#L333 and add an extra setting to the Mollie provider for "Pending Payments URL" then when you check the order on return, if it's pending, send the end user to "Your order is pending" page.

    Update Hmm, one issue with this is that untill the order is finalized in some way then the order will remain a cart, so it may be that we also need to set the order status to PendingExternalSystem and force it to finalize.

  • anh-duc-le 36 posts 150 karma points
    Feb 20, 2023 @ 13:58
    anh-duc-le
    0

    Seems like we customized the VendrCheckoutConfirmationPage.cshtml with some event tracking and did not do a proper check there whether the FinalizedDate on the current order would be not null and IsFinalized would be true before attempting to use that data in our even tracking.

    This is what caused the unexpected exception on our site.

    I have now fixed this specific error.

    Besides that I think it would be good to have a PendingExternalSystem status. As currently there is no way of telling how many orders are awaiting payment through bank transfer. These orders remain in the Carts section until a payment has been fulfilled and the order can be finalized.

  • Matt Brailsford 4123 posts 22194 karma points MVP 9x c-trib
    Feb 20, 2023 @ 14:10
    Matt Brailsford
    1

    Ahh, cool.

    And yea, I've just built an unstable build where I've added this in so potentially worth you giving it a try. You can find v2.0.2-beta0006 on our unstable feed at https://nuget.outfield.digital/unstable/vendr/v3/index.json if you want to give it a try.

    This basically still redirects to the confirmation page, but if when it does the redirect, the mollie order is pending, it will finalize the order setting it to pending before redirecting.

  • anh-duc-le 36 posts 150 karma points
    Jun 05, 2023 @ 13:41
    anh-duc-le
    0

    Is this feature already included with the recently released version v2.0.2 of the package?

  • Matt Brailsford 4123 posts 22194 karma points MVP 9x c-trib
    Jun 05, 2023 @ 14:39
    Matt Brailsford
    100

    It is yea 👍

  • anh-duc-le 36 posts 150 karma points
    Jun 06, 2023 @ 09:49
    anh-duc-le
    0

    Just updated my package and am not seeing the order get finalized once I've selected a SEPA bank transfer payment option.

    I tested this with Mollie payment in LIVE mode so I can actually go through the SEPA Bank Transfer flow and get redirected back to the website.

    Could it perhaps be that orders can only be finalized on the actual live environment and not just a test environment where the payment method is set to LIVE mode?


    My other Vendr packages are running on the following versions:

    • Vendr 3.0.11
    • Vendr.Checkout 3.0.0
    • Vendr.Core 3.0.11
    • Vendr.Umbraco.Startup 3.0.11
    • Vendr.uSync 3.0.0
  • Matt Brailsford 4123 posts 22194 karma points MVP 9x c-trib
    Jun 06, 2023 @ 10:21
    Matt Brailsford
    0

    When testing locally you need to use something like ngrok to expose a public URL in order for you to receive webhook responses. Docs here https://vendr.net/docs/payment-providers/mollie/2.0.0/mollie-onetime/how-to-guides/testing-mollie-webhooks-locally/

  • anh-duc-le 36 posts 150 karma points
    Jun 06, 2023 @ 13:41
    anh-duc-le
    0

    Ah my bad, I should've mentioned I already had it running in ngrok. This problem exists with the ngrok URL exposed.

    I get directed to the Mollie payment options and redirected back to the ngrok instance, but the cart does not get finalized into an order

  • anh-duc-le 36 posts 150 karma points
    Jun 09, 2023 @ 13:03
    anh-duc-le
    0

    Haven't had any luck yet with getting a Cart to finalize into an Order with payment status Pending, neither on my acceptance server nor my ngrok published local environment. SEPA Bank transfer redirects me back to the website without finalizing the order. Regular Mollie direct payments with iDEAL get finalized without issue though.

    But besides that, to which notification event do I need to listen for fetching PaymentStatus changes?

    My current code listens to the OrderFinalizedNotification event with the assumption that this only gets triggered by Captured payments. But with the new situation an order can be finalized with a Pending payment status.

    To which Notification event can I listen to catch whether the payment is captured by Mollie and called back to the server with the payment status change from Pending to Captured?

    Would it be OrderPaymentMethodChangedNotification?

  • Matt Brailsford 4123 posts 22194 karma points MVP 9x c-trib
    Jun 19, 2023 @ 07:53
    Matt Brailsford
    100

    Hey anh-duc-le

    Apologies on the delay in looking into this, the lead up to Codegarden has been pretty hectic.

    I don't suppose you have any details on how this can be tested in a test environment? I can't seem to find any docs on the Mollie site specific to testing SEPA payments 🤔

    PS Regarding the event to listen to, you can listen to OrderTransactionUpdatedNotification to be notified when the transaction data including the payment status changes.

  • anh-duc-le 36 posts 150 karma points
    Jun 19, 2023 @ 13:55
    anh-duc-le
    0

    Haha no worries, hope you had a good time at Codegarden!

    Yeah Mollie is quite funky when it comes to testing SEPA payments. When selecting SEPA bank transfer as payment option in test-mode, they don't send you back to the website like they do with a direct payment.

    You can go to the Mollie Dashboard https://my.mollie.com/dashboard/ to look up the created SEPA bank transfer transaction, within the transaction is the callback URL for the transaction with payment status OPEN. This is what you would usually be redirected to if you try a SEPA banktransfer from the Live-mode.

    I had contact with Mollie last week, they mentioned they won't be doing any webhook callbacks from their side other than when the payment is Cancelled, Expired or Paid. They linked me to the documentation here

    I assume you don't check for a Mollie callback when a customer loads the the Mollie callback url of the still pending SEPA banktransfer transaction but instead just finalize the Cart with payment status Pending?

  • Matt Brailsford 4123 posts 22194 karma points MVP 9x c-trib
    Jun 19, 2023 @ 14:09
    Matt Brailsford
    0

    That's the idea yea. You can see what we are attempting to do here.

    https://github.com/vendrhub/vendr-payment-provider-mollie/blob/v2/main/src/Vendr.PaymentProviders.Mollie/MollieOneTimePaymentProvider.cs#L348-L362

    Basically, when we handle being redirected back to the site, if it's not a cancellation we check the order status and if it's "pending" then we finalize the order at this stage setting the order to PendingExternslSystem and then perform our normal redirect routine.

    I'm wondering then if at this stage, maybe the order isn't "pending" but is instead "open" and so the order doesn't get finalized. If that is the case then I'm not sure what we could do as an "open" status isn't really indicative of an order being in a "progress" status 🤔

  • Matt Brailsford 4123 posts 22194 karma points MVP 9x c-trib
    Jun 19, 2023 @ 14:15
    Matt Brailsford
    0

    Hmm, the docs here is pretty interesting https://docs.mollie.com/orders/status-changes#pending specifically

    Currently only Klarna Pay now, Klarna Pay later and Klarna Slice it use this status.

    This would suggest the "pending" order status isn't used for SEPA payments awaiting manual approval.

    If this is true, then I'm wondering what status an order is that uses SEPA 🤔

  • anh-duc-le 36 posts 150 karma points
    Jun 19, 2023 @ 14:30
    anh-duc-le
    0

    Ah that would explain why the new feature doesn't get triggered. SEPA banktransfer seems to only exist in the status Open, Cancelled, Expired and Paid.

    I think the Pending status makes sense with Klarna being a "loan" that you pay off afterwards, whereas SEPA banktransfer doesn't exactly equal a guaranteed transaction until the actual transfer has happened.

    A customer could choose to let the SEPA banktransfer expire, not transferring the money is the same as quitting halfway through filling out your credit card info.

    So maybe it doesnt exactly make sense to finalize a Vendr Cart into a Vendr Order when one chooses for a SEPA bank transfer?

  • Matt Brailsford 4123 posts 22194 karma points MVP 9x c-trib
    Jun 19, 2023 @ 14:38
    Matt Brailsford
    0

    I mean, there must be some kind of "state" that is the customer has submitted the payment details but the bank transfer is awaiting payment. This is really what we need to know because we need to finalize the order at this stage and set it to pending. We couldn't leave it open as someone could add more to it.

    The order needs moving to pending and then whatever the outcome of the transfer it should then update accordingly a few days later, so either Cancelled or Captured

    The only thing I can think to do is another check in that handler that says "is it open and is it a banktransfer or directdebit and if so, finalize the order" but I'm not sure if this is 100% correct. We need some indication the payment request email was sent 🤔

  • Matt Brailsford 4123 posts 22194 karma points MVP 9x c-trib
    Jun 19, 2023 @ 14:46
    Matt Brailsford
    0

    Or maybe it is enough as I guess the redirect back to the site is a sort of indication the request for a transfer was ok, so if they aren't being sent to the cancel URL then it must be ok 🤔

  • anh-duc-le 36 posts 150 karma points
    Jun 19, 2023 @ 14:49
    anh-duc-le
    0

    Ah yeah it would have to be finalized.

    Here is an example screen of a SEPA banktransfer transaction in Mollie. It is very limited in transaction details data other than that the status is Open.

    I assume the event Payment of type bank transfer created 19 June 2023 at 16:45 could be considered a confirmation that the payment request email was sent.

    SEPA Bank transfer  transaction details

  • Matt Brailsford 4123 posts 22194 karma points MVP 9x c-trib
    Jun 19, 2023 @ 15:14
    Matt Brailsford
    0

    Ok, so I've create a new build on our unstable feed at https://nuget.outfield.digital/unstable/vendr/v3/index.json v2.0.3-beta0001 if you want to try this.

    I've done the check I mentioned before, but I am wondering if we could just assume any Mollie order set to Open should also be set to PendingExtenalSystem but for now I've restricted it to banktransfer (I think directdebit might also need this).

    Let me know if this resolves your issue and I'll get an actual release pushed out.

  • anh-duc-le 36 posts 150 karma points
    Jun 20, 2023 @ 10:11
    anh-duc-le
    0

    Sadly it doesnt seem to do anything.

    Does ProcessRedirectCallbackAsync get triggered when loading the callback URL or only when receiving a callback from Mollie? Because I think the latter does not happen with SEPA banktransfer, I think it only links the customer to the callback URL without a call from Mollie to the webhook

    Screen after choosing SEPA banktransfer as payment method

  • Matt Brailsford 4123 posts 22194 karma points MVP 9x c-trib
    Jun 20, 2023 @ 10:28
    Matt Brailsford
    0

    We have to do special things for Mollie because they don't have a cancel URL like most other payment gateways do so with Mollie EVERYTHING goes via the ProcessCallback method and then this decides where to redirect to.

    https://github.com/vendrhub/vendr-payment-provider-mollie/blob/v2/main/src/Vendr.PaymentProviders.Mollie/MollieOneTimePaymentProvider.cs#L313

    To handle redirects, we append a "?redirect=true" to the URL we pass to Mollie so we can detect when we are coming back to the site

    https://github.com/vendrhub/vendr-payment-provider-mollie/blob/v2/main/src/Vendr.PaymentProviders.Mollie/MollieOneTimePaymentProvider.cs#L279

    So when we navigate back to the site we should hit the following code block which should then finalize the payment with a PendingExternalSystem status

    https://github.com/vendrhub/vendr-payment-provider-mollie/blob/v2/main/src/Vendr.PaymentProviders.Mollie/MollieOneTimePaymentProvider.cs#L346

    So when you are redirected back to the confirmation page, it should finalize the order then. This is not ideal as customers could navigate away, but given Mollie gives no other notifications there really isn't an alternative.

  • Matt Brailsford 4123 posts 22194 karma points MVP 9x c-trib
    Jun 21, 2023 @ 07:01
    Matt Brailsford
    0

    I don't suppose you'd be up for compiling and debugging into the source code for the Mollie provider and seeing why it's not being handled via the code added would you?

    https://github.com/vendrhub/vendr-payment-provider-mollie

    It would be good to know when the redirect back to the site occurs, if it skips past that code block, why that is? Is it a different "payment type"? or something else?

  • anh-duc-le 36 posts 150 karma points
    Jun 21, 2023 @ 13:30
    anh-duc-le
    1

    I could give it a try when I'm working on it again on Monday. I'm also quite curious

Please Sign in or register to post replies

Write your reply to:

Draft