Is this possible with Braintree(payment gateway) along with PHP to make a sale transaction for all the users at once. Like i want to make sale transaction only when minimum number of users are subscribed.
Here is the which I am trying to use:
// Make a sale transaction for all the users at once.
for ($x = 0; $x <= count($users); $x++) {
$result = \Braintree\Transaction::sale(array(
'amount' => Session::get('price'),
'paymentMethodNonce' => $request->payment_method_nonce,
'customer' => [
'id' => $user->id,
],
'options' => [
'submitForSettlement' => True,
]
));
}
Nonces are one time use only, so the only way this would work is if you used payment method tokens, which you would have to return from each customer's result object.