We have implemented paypal subscription payment. I have completed the following steps.
- Create a payment plan.
- Activate the plan
- Create a payment agreement.
- Get user signup to a specific agreement (Divert to agreement url)
- Execute the payment.
But my current project involves multiple subscriptions in one checkout. You can signup for 2 subscriptions with two different products and pay at once, but both products will be set to auto renew.
My issue is how can i achieve multiple subscriptions so user has to agree with only one payment agreement(One checkout). And later on they can switch on and off auto subscription for one product if they want to.
I have already tried the following.
$plan_1 = new Plan();
$plan_1->setId('P-****************');
$plan_2 = new Plan();
$plan_2->setId('P-************');
$agreement->setPlan($plan_1);
$agreement->setPlan($plan_2);
But an agreement can have only one plan apparently. I cannot pass two plans to one agreement. How can i do it so user has to visit paypal only once?