protected void Submit_Click(object sender, EventArgs e)
        {
            // Create request object
            SetCustomerBillingAgreementRequestType request = new SetCustomerBillingAgreementRequestType();
            SetCustomerBillingAgreementRequestDetailsType requestDetails = new SetCustomerBillingAgreementRequestDetailsType();
            requestDetails.BuyerEmail = buyerEmail.Value;
            requestDetails.ReturnURL = returnUrl.Value;
            requestDetails.CancelURL = cancelUrl.Value;
            BillingAgreementDetailsType baDetails = new BillingAgreementDetailsType();
            baDetails.BillingAgreementDescription = billingAgreementText.Value;
            baDetails.BillingType = (BillingCodeType)
                Enum.Parse( typeof(BillingCodeType), billingType.SelectedValue);
            requestDetails.BillingAgreementDetails = baDetails;
            request.SetCustomerBillingAgreementRequestDetails = requestDetails;

            // Invoke the API
            SetCustomerBillingAgreementReq wrapper = new SetCustomerBillingAgreementReq();
            wrapper.SetCustomerBillingAgreementRequest = request;
            PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService();
            SetCustomerBillingAgreementResponseType setCustomerBillingAgreementResponse =
                    service.SetCustomerBillingAgreement(wrapper);

            // Check for API return status
            setKeyResponseObjects(service, setCustomerBillingAgreementResponse);
        }
        protected void Submit_Click(object sender, EventArgs e)
        {
            // Create request object
            SetCustomerBillingAgreementRequestType request = new SetCustomerBillingAgreementRequestType();

            SetCustomerBillingAgreementRequestDetailsType requestDetails = new SetCustomerBillingAgreementRequestDetailsType();

            // (Optional) Email address of the buyer as entered during checkout. PayPal uses this value to pre-fill the PayPal membership sign-up portion of the PayPal login page.
            requestDetails.BuyerEmail = buyerEmail.Value;
            // (Required) URL to which the buyer's browser is returned after choosing to pay with PayPal.
            // Note: PayPal recommends that the value be the final review page on which the buyer confirms the billing agreement.
            requestDetails.ReturnURL = returnUrl.Value;
            // (Required) URL to which the customer is returned if he does not approve the use of PayPal to pay you.
            // Note: PayPal recommends that the value be the original page on which the customer chose to pay with PayPal or establish a billing agreement.
            requestDetails.CancelURL = cancelUrl.Value;

            // (Required) Details of the billing agreement such as the billing type, billing agreement description, and payment type.
            BillingAgreementDetailsType baDetails = new BillingAgreementDetailsType();
            // Description of goods or services associated with the billing agreement. This field is required for each recurring payment billing agreement. PayPal recommends that the description contain a brief summary of the billing agreement terms and conditions. For example, buyer is billed at "9.99 per month for 2 years."
            baDetails.BillingAgreementDescription = billingAgreementText.Value;
            // (Required) Type of billing agreement. For recurring payments, this field must be set to RecurringPayments. In this case, you can specify up to ten billing agreements. Other defined values are not valid.
            // Type of billing agreement for reference transactions. You must have permission from PayPal to use this field. This field must be set to one of the following values:
            // * MerchantInitiatedBilling- PayPal creates a billing agreement for each transaction associated with buyer. You must specify version 54.0 or higher to use this option.
            // * MerchantInitiatedBillingSingleAgreement- PayPal creates a single billing agreement for all transactions associated with buyer. Use this value unless you need per-transaction billing agreements. You must specify version 58.0 or higher to use this option.
            baDetails.BillingType = (BillingCodeType)
                Enum.Parse( typeof(BillingCodeType), billingType.SelectedValue);
            requestDetails.BillingAgreementDetails = baDetails;
            request.SetCustomerBillingAgreementRequestDetails = requestDetails;

            // Invoke the API
            SetCustomerBillingAgreementReq wrapper = new SetCustomerBillingAgreementReq();
            wrapper.SetCustomerBillingAgreementRequest = request;

            // Configuration map containing signature credentials and other required configuration.
            // For a full list of configuration parameters refer in wiki page
            // [https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters]
            Dictionary<string, string> configurationMap = Configuration.GetAcctAndConfig();

            // Create the PayPalAPIInterfaceServiceService service object to make the API call
            PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);

            // # API call
            // Invoke the SetCustomerBillingAgreement method in service wrapper object
            SetCustomerBillingAgreementResponseType setCustomerBillingAgreementResponse =
                    service.SetCustomerBillingAgreement(wrapper);

            // Check for API return status
            setKeyResponseObjects(service, setCustomerBillingAgreementResponse);
        }
        /// <summary>
        /// 
        /// </summary>
        ///<param name="setCustomerBillingAgreementReq"></param>
        ///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param> 
        public SetCustomerBillingAgreementResponseType SetCustomerBillingAgreement(SetCustomerBillingAgreementReq setCustomerBillingAgreementReq, ICredential credential)
        {
            setStandardParams(setCustomerBillingAgreementReq.SetCustomerBillingAgreementRequest);
            DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(this.config, setCustomerBillingAgreementReq.ToXMLString(null, "SetCustomerBillingAgreementReq"), null, null);
            IAPICallPreHandler apiCallPreHandler = new MerchantAPICallPreHandler(this.config, defaultHandler, credential);
            ((MerchantAPICallPreHandler) apiCallPreHandler).SDKName = SDKName;
            ((MerchantAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion;
            ((MerchantAPICallPreHandler) apiCallPreHandler).PortName = "PayPalAPIAA";

            XmlDocument xmlDocument = new XmlDocument();
            xmlDocument.LoadXml(Call(apiCallPreHandler));
            return new SetCustomerBillingAgreementResponseType(
                xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='SetCustomerBillingAgreementResponse']")
            );
        }
 /// <summary> 
 /// 
 /// </summary>
 ///<param name="setCustomerBillingAgreementReq"></param>
 public SetCustomerBillingAgreementResponseType SetCustomerBillingAgreement(SetCustomerBillingAgreementReq setCustomerBillingAgreementReq)
 {
     return SetCustomerBillingAgreement(setCustomerBillingAgreementReq,(string) null);
 }
 /**
   *AUTO_GENERATED
  	  */
 public SetCustomerBillingAgreementResponseType SetCustomerBillingAgreement(SetCustomerBillingAgreementReq setCustomerBillingAgreementReq, string apiUserName)
 {
     IAPICallPreHandler apiCallPreHandler = null;
      		string portName = "PayPalAPIAA";
     setStandardParams(setCustomerBillingAgreementReq.SetCustomerBillingAgreementRequest);
     DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(setCustomerBillingAgreementReq.ToXMLString(null, "SetCustomerBillingAgreementReq"), null, null);
     apiCallPreHandler = new MerchantAPICallPreHandler(defaultHandler, apiUserName, getAccessToken(), getAccessTokenSecret());
     ((MerchantAPICallPreHandler) apiCallPreHandler).SDKName = SDKName;
     ((MerchantAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion;
     ((MerchantAPICallPreHandler) apiCallPreHandler).PortName = portName;
     string response = Call(apiCallPreHandler);
     XmlDocument xmlDocument = new XmlDocument();
     xmlDocument.LoadXml(response);
     XmlNode xmlNode = xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='SetCustomerBillingAgreementResponse']");
     return new SetCustomerBillingAgreementResponseType(xmlNode);
 }
 /**
   *AUTO_GENERATED
  	  */
 public SetCustomerBillingAgreementResponseType SetCustomerBillingAgreement(SetCustomerBillingAgreementReq setCustomerBillingAgreementReq, string apiUserName)
 {
     setStandardParams(setCustomerBillingAgreementReq.SetCustomerBillingAgreementRequest);
     string response = Call("SetCustomerBillingAgreement", setCustomerBillingAgreementReq.ToXMLString(), apiUserName);
     XmlDocument xmlDocument = new XmlDocument();
     xmlDocument.LoadXml(response);
     XmlNode xmlNode = xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='SetCustomerBillingAgreementResponse']");
     return new SetCustomerBillingAgreementResponseType(xmlNode);
 }
 public SetCustomerBillingAgreementResponseType SetCustomerBillingAgreement(SetCustomerBillingAgreementReq SetCustomerBillingAgreementReq)
 {
     return SetCustomerBillingAgreement(SetCustomerBillingAgreementReq, null);
 }
        /**
         *
         */
        public SetCustomerBillingAgreementResponseType SetCustomerBillingAgreement(SetCustomerBillingAgreementReq SetCustomerBillingAgreementReq, string apiUsername)
        {
            setStandardParams(SetCustomerBillingAgreementReq.SetCustomerBillingAgreementRequest);
            string resp = call("SetCustomerBillingAgreement", SetCustomerBillingAgreementReq.toXMLString(), apiUsername);

            return new SetCustomerBillingAgreementResponseType(resp);
        }