Click here to Skip to main content
15,898,949 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Always getting exception The request was aborted: Could not create SSL/TLS secure channel.
Please help


C#
CallerServices caller = new CallerServices();

            IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();

            // Set up your API credentials, PayPal end point, and API version.
            profile.APIUsername = ConfigurationManager.AppSettings["APIusername"].ToString();
            profile.APIPassword = ConfigurationManager.AppSettings["APIpassword"].ToString();
            profile.APISignature = ConfigurationManager.AppSettings["APIsignature"].ToString();
            profile.Environment = ConfigurationManager.AppSettings["APIEnv"].ToString();
            caller.APIProfile = profile;

            // Create the request object.
            SetExpressCheckoutRequestType pp_request = new SetExpressCheckoutRequestType();
            pp_request.Version = "51.0";

            BillingAgreementDetailsType billingAgreement = new BillingAgreementDetailsType();
            billingAgreement.BillingType = BillingCodeType.MerchantInitiatedBilling;// BillingCodeType.RecurringPayments;
            billingAgreement.BillingAgreementDescription = "Membership Payment";
            List<BillingAgreementDetailsType> agreementList = new List<BillingAgreementDetailsType>();
            agreementList.Add(billingAgreement);

           
            pp_request.SetExpressCheckoutRequestDetails = new SetExpressCheckoutRequestDetailsType();
            pp_request.SetExpressCheckoutRequestDetails.PaymentAction = PaymentActionCodeType.Sale;//Enum for PaymentAction is  PaymentActionCodeType.Sale
            pp_request.SetExpressCheckoutRequestDetails.PaymentActionSpecified = true;
            pp_request.SetExpressCheckoutRequestDetails.BillingAgreementDetails = agreementList.ToArray();
            

            pp_request.SetExpressCheckoutRequestDetails.OrderTotal = new BasicAmountType();

            pp_request.SetExpressCheckoutRequestDetails.OrderTotal.currencyID = CurrencyCodeType.USD;//Enum for currency code is  CurrencyCodeType.USD

            pp_request.SetExpressCheckoutRequestDetails.OrderTotal.Value = paymentAmount;
            pp_request.SetExpressCheckoutRequestDetails.OrderDescription = "Membership Subscription";

            pp_request.SetExpressCheckoutRequestDetails.NoShipping = "1";
            pp_request.SetExpressCheckoutRequestDetails.BuyerEmail = buyerPaypalId;

            pp_request.SetExpressCheckoutRequestDetails.CancelURL = ConfigurationManager.AppSettings["HTTPSInitial"].ToString() + cancelurl;
            pp_request.SetExpressCheckoutRequestDetails.ReturnURL = ConfigurationManager.AppSettings["HTTPSInitial"].ToString() + returnurl;
            
            
            
            

            // Execute the API operation and obtain the response.
            SetExpressCheckoutResponseType pp_response = new SetExpressCheckoutResponseType();
            pp_response = (SetExpressCheckoutResponseType)caller.Call("SetExpressCheckout", pp_request);
Posted
Updated 17-Apr-14 20:49pm
v2
Comments
Anderson Fetter 7-Apr-16 0:33am    
Do you have a solution to it?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900