Flag to indicate separate membership payment
When the "Separate Membership Payment" option is enabled on a contribution page
doPayment() is called twice with different amounts and descriptions. However, there is no way to identify that they are part of the same form submission once doPayment is called.
In order to process the second payment for the same submission we need to know that it is a second payment so we can handle the token differently.
My proposal is to add an additional flag to the
$params array that is passed to doPayment:
PR that implements this: https://github.com/civicrm/civicrm-core/pull/12358
This allows the following code to be implemented in the payment processor: https://github.com/mattwire/com.drastikbydesign.stripe/commit/b648603c0dc1a2aef569537f95ceb46612df3204#diff-8dcbf2bfe3fcb3899e049399543df444R559
Note that the code being removed in that commit did not work as both params were always set.