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);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)