Retrieving the Plan from the Create Update Sample. This would be used to define Plan information to create an agreement. Make sure the plan you are using is in active state.
Add Plan ID Please note that the plan Id should be only set in this case.
Add Payer
Add Credit Card to Funding Instruments
Add Shipping Address
For Sample Purposes Only.
Please note that as the agreement has not yet activated, we wont be receiving the ID just yet.
Create Billing Agreement with Credit Card as Payment Source
This sample code demonstrate how you can create a billing agreement, as documented here at: https://developer.paypal.com/webapps/developer/docs/api/#create-an-agreement API used: /v1/payments/billing-agreements