Hi Dennis
Are you using a custom payment provider here?
I gave this some though over the weekend and something doesn’t seem right.
Generally speaking with Payment Providers, the GenerateForm
method is normally what sets up the payment at the payment gateway and then the customer is redirected to pay. It is also here that InitializeTransaction
is called. We then get a callback (webhook response) that would capture the details of the payment and update the order calling FinalizerOrder
. Now I get this isn’t what you want as you need to do everything all at once in code.
The problem I see is that you are calling CaptureOrderPaymentAsync
to handle capturing the payment. But in a “normal” payment provider this would only be called for payments that have already been placed but are in an Authorized
state, however here it seems like you are using the CaptureOrderPaymentAsync
to perform the entire placement of the order and capture the payment all in one.
This could potentially cause problems if someone was to click the “Capture” button in the back office if you ever have the position where an order is captured but Authorized
.
Ultimately, if you are aware of this stuff and you are just using CaptureOrderPaymentAsync
as a means for placing and capturing an order in one, and this payment provider is used only for this purpose, then that’s probably OK. But from our perspective, that’s a non standard way of using the payment providers and so I don’t think there is anything we can do about updating the docs with additional code examples.
I hope this make sense.