initialize: Instantiate state and set it to state object. writing a new payment transaction might lead
Integrity constraint violation foreign key constraint fails in sales_payment_transaction while model order be saved, it could create(insert) another row to sales_payment_transaction literally this action should be performed after order be saved which is authorize or capture
See https://github.com/omise/omise-magento/blob/v2.27.0/etc/di.xml#L967 https://github.com/omise/omise-magento/blob/v2.27.0/etc/di.xml#L973-L981 https://github.com/omise/omise-magento/blob/v2.27.0/etc/di.xml#L996-L1004
And how the Payment Handle Detail writing a transaction before order was created https://github.com/omise/omise-magento/blob/v2.27.0/Gateway/Response/PaymentDetailsHandler.php#L67-L82
because
initialize: Instantiate state and set it to state object. writing a new payment transaction might lead Integrity constraint violation foreign key constraint fails in sales_payment_transaction while model order be saved, it could create(insert) another row to sales_payment_transaction literally this action should be performed after order be saved which is authorize or capture