Bertrand game with delivery risk and side payments
I am not going to give a solution to you question (as I am not able too). However, let me try to indicate the difficulty of obtaining one if you cannot find a closed form solution for $q_1$ and $q_2$ in the last stage of the game.
Let $\Pi(q_1, q_2, p_1, p_2, B)$ be the objective function that we want to maximize. Assuming we can totally differentiate this, we get:
$$
d\Pi = \Pi_{q_1} dq_1 + \Pi_{q_2} dq_2 + \Pi_{p_1} dp_1 + \Pi_{p_2} dp_2 + \Pi_B dB. \tag{1}
$$
Assume the first order conditions hold:
$$
\Pi_{q_1} = 0\\
\Pi_{q_2} = 0 \tag{foc-stage3}
$$
This then simplifies $(1)$ to:
$$
d\Pi = \Pi_{p_1} dp_1 + \Pi_{p_2} dp_2 + \Pi_B dB \tag{1.a}
$$
The problem here is that we can not drop the $dp_1$ and $dp_2$ terms as they are (in general) both going to be a function of $B$.
Assume that the first order conditions $\rm{(foc-stage3)}$ can be solved to give a solution $q_2(p_1, p_2, B)$ and $q_1(p_1, p_2, B)$. Then in stage 2 of the game, Firm 2 maximizes:
$$
p_2 q_2(p_1, p_2, B)
$$
Again, assume that the first order conditions hold:
$$
q_2 + p_2 \frac{\partial q_2}{\partial p_2} = 0 \tag{foc-stage2}
$$
We can totally differentiate this with respect to $p_1$ and $p_2$ and $B$ (notice that $q_2$ is a function of all three these variables). This gives:
$$
\left(2\frac{\partial q_2}{\partial p_2} + p_2 \frac{\partial^2 q_2}{\partial p_2\partial p_2}\right) dp_2 = -\left(\frac{\partial q_2}{\partial p_1} + p_2 \frac{\partial^2 q_2}{\partial p_2 \partial p_1}\right) dp_1 - \left(\frac{\partial q_2}{\partial B} + p_2 \frac{\partial^2 q_2}{\partial p_2 \partial B}\right) dB \tag{2}
$$
Let $p_2(p_1, B)$ be the optimal solution of firm 2 (by solving $({\rm foc-stage2})$. Then in stage 1, Firm 1 maximizes
$$
p_1 q_1(p_1, p_2(p_1, B), B)
$$
So:
$$
q_1 + p_1 \frac{\partial q_1}{\partial p_1} + p_1 \frac{\partial q_1}{\partial p_2} \frac{\partial p_2}{\partial p_1}= 0 \tag{foc-stage1}
$$
Assuming again that this can be totally differentiated with respect to $p_1$ and $B$, we obtain:
$$
\begin{align*}
\left(\frac{\partial q_1}{\partial p_1} + \frac{\partial q_1}{\partial p_1} + p_1 \frac{\partial^2 q_1}{\partial p_1 \partial p_1} + \frac{\partial^2 q_1}{\partial p_2\partial p_1}\frac{\partial p_2}{\partial p_1} + \frac{\partial q_1}{\partial p_2}\frac{\partial^2 p_2}{\partial p_1\partial p_1}\right) dp_1\\
=- \left(\frac{\partial q_1}{\partial B} + p_1 \frac{\partial^2 q}{\partial p_1 \partial B} + \frac{\partial^2 q_1}{\partial p_2 \partial B} \frac{\partial p_2}{\partial p_1} + \frac{\partial q_1}{\partial p_2} \frac{\partial^2 p_2}{\partial p_1 \partial B}\right) dB \tag{3}
\end{align*}
$$
Then we can use $(3)$ to substitute for $d p_1$ in $(2)$. Then $(2)$ and $(3)$ give $dp_1$ and $dp_2$ in terms of only  $dB$. This can be substituted into $(1.a)$ to give the total effect of $B$ on $\Pi$.