5222374046
Increase the payment budget before attempting the payment and decrease again if the payment fails. This prevents a race where multiple concurrent payments could pass the budget check before the budget is incremented through any of the other payments. A lock around the budget is not suitable either as then one long stuck payment (hold invoice) would render the budget inaccessible for all other payment attempts.