I am developing a fundraising platform of sorts and could use some help.
Assume I have set out to raise $100 (hard capped at $100, not a cent more) and currently have an array of 10 commitments of $15 each towards the goal. Since the total commitments exceed the $100, I need to structure the loop so that 100% of each commitment is charged and then only a partial final charge to get exactly the goal amount on the remaining commitment.
In the example, it would be 6, $15 charges to get to $90 then one final charge amount for the remainder of $10 on the 7th commitment. The others are never made.
Assume I already have the code to make the charges, this is just about structuring the loop to get the proper amounts billed to match the exact fundraising goal.
Any thoughts would be appreciated.