@rvdsteege How constant are PRONAMIC_PAY_MEMBERPRESS_REFUNDED_TRANSACTION_ID and PRONAMIC_PAY_MEMBERPRESS_CHARGED_BACK_TRANSACTION_ID? I think we should avoid such constructions. Move the $memberpress_gateway->record_refund(); implementation to maybe_record_memberpress_transaction_refund( Payment $payment )?
Something I noticed quickly in https://github.com/pronamic/wp-pronamic-pay-memberpress/commit/d3f586bac90da4adb096512cd471c75b4eb4d9c9.
https://github.com/pronamic/wp-pronamic-pay-memberpress/commit/d3f586bac90da4adb096512cd471c75b4eb4d9c9#commitcomment-74885292