BillingAgreement Property
BillingAgreements is an array that contains a list of billing agreements to be created.
Syntax
expresscheckout.getBillingAgreement(index, [callback]) expresscheckout.setBillingAgreement(index, billingAgreement, [callback])
Default Value
"0"
Callback
The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).
The callback for the getBillingAgreement([callback]) method is defined as:
function(err, data){ }
'err' is the error that occurred. If there was no error, then 'err' is 'null'.
'data' is the value returned by the method.
The callback for the setBillingAgreement([callback]) method is defined as:
function(err){ }
'err' is the error that occurred. If there was no error, then 'err' is 'null'.
'err' has 2 properties which hold detailed information:
err.code err.message
Remarks
This property contains an array which lists the description of billing agreements to be created. It should only be used when calling SetCheckout to create new billing agreements that will be used by the RecurringPayments component to create a new profile.
Each index in the array specifies the description for a separate billing agreement to create an express checkout for. In order to use this checkout when CreateProfile is called, the description included in the new profile must match the one in this array. Additionally, the ResponseToken must be saved and included as well.
If there are direct payment items included in the checkout, payment for those items must be completed before creating the recurring payments profile. Also, the customer must accept the billing agreement from the location provided in the example below.
The following example shows how to successfully use this property when creating a new
recurring payments profile:
ExpressCheckout1.OrderTotal = "0" ExpressCheckout1.ReturnURL = "http://localhost" ExpressCheckout1.CancelURL = "http://localhost" ExpressCheckout1.BillingAgreements = new String[1] ExpressCheckout1.BillingAgreements[0] = "My Description" ExpressCheckout1.SetCheckout()The customer must now login and accept the Billing Agreement before creating the actual profile or the CreateProfile() call will fail. The customer may accept the agreement from the site that is created by substituting the actual ResponseToken in the following URL:
URL: https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_customer-billing-agreement&token=PUT_TOKEN_HERE
Once the customer has been redirected to the above URL and accepted the billing agreement, the
following code will create a new profile:
RecurringPayments1.Token = ExpressCheckout1.ResponseToken RecurringPayments1.Description = "My Description" RecurringPayments1.BillingDetails.Period = BillingPeriods.bpMonth RecurringPayments1.BillingDetails.Frequency = "12" RecurringPayments1.BillingDetails.Amount = "12.01" RecurringPayments1.BillingDetails.StartDate = "2009-08-25T07:00:00Z" RecurringPayments1.CreateProfile()Note that the BillingAgreements value and the Description must match for the profile to be successfully created.
This property is not available at design time.
Data Type
String