For demonstration purposes, we'll first setup a billing plan in an active state to be used to make an agreement with.
Note: Both
return_url
andcancel_url
are being set inplan.merchant_preferences
since many plans may be setup well in advance of anyone setting up an agreement for it. These URLs are only used for agreements setup withpayer.payment_method
set topaypal
to establish where the customer should be redirected once they approve or cancel the agreement using their PayPal account.
Activate the plan
With the plan created and activated, we can now create the billing agreement. A resource representing a Payer that funds a payment.
Create the billing agreement.
For more information, please visit PayPal Developer REST API Reference.
Api Context
Pass in a
APIContext
object to authenticate the call and to send a unique request id (that ensures idempotency). The SDK generates a request id if you do not pass one explicitly. See Configuration.cs to know more about APIContext.