Code: Select all
If _Order.PaymentStatus <> OrderPaymentStatus.Paid Then
For Each _Payment As Payment In _Order.Payments
If _Payment.PaymentStatus = PaymentStatus.Authorized Then
' capture payment and exit loop
_Payment.Capture(_Order.TotalCharges, True, True, "127.0.0.1")
Exit For
End If
Next
If _Order.PaymentStatus <> OrderPaymentStatus.Paid Then
' problem capturing payment, abort auto-processing
Return
End If
End If

Second, despite a single authorization being correctly captured the _Order.PaymentStatus is not reporting as paid immediately after payment capture.
Why? Is there some sort of child-update that has to occur on _Order to reflect the change in payment status?