예제 #1
0
        private static IAPIProfile CreateAPIProfile(string PayPalUserName, string PayPalPassword, string PayPalSignature,
                                                    string subject, string mode)
        {
            try
            {
                var profile = ProfileFactory.createSignatureAPIProfile();

                if (profile != null)
                {
                    profile.Environment = mode;

                    EventLog.LogEvent("PayPal Express Get Api", "Getting Environment " + mode,
                                      EventLogSeverity.Information);

                    profile.APIUsername  = PayPalUserName;
                    profile.APIPassword  = PayPalPassword;
                    profile.APISignature = PayPalSignature;
                    profile.Subject      = subject;
                }
                else
                {
                    EventLog.LogEvent("Paypal API",
                                      "Paypal com.paypal.sdk.profiles.ProfileFactory.CreateAPIProfile has failed.",
                                      EventLogSeverity.Error);
                }
                return(profile);
            }
            catch (Exception ex)
            {
                EventLog.LogEvent("PayPal Utilities", ex.Message + " | " + ex.StackTrace, EventLogSeverity.Warning);
            }
            return(null);
        }
예제 #2
0
        public static IAPIProfile CreateAPIProfile(string apiUsername, string apiPassword, string signature, string CertificateFile_Sig, string APISignature_Sig, string CertificateFile_Cer, string PrivateKeyPassword_Cer, string stage, string subject, bool is3token, bool isunipay)
        {
            if (is3token == true)
            {
                IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
                profile.APIUsername  = apiUsername;
                profile.APIPassword  = apiPassword;
                profile.Environment  = stage;
                profile.Subject      = subject;
                profile.APISignature = signature;
                return(profile);
            }
            //else if (Global.isunipay == true)
            else if (isunipay == true)
            {
                IAPIProfile profile = ProfileFactory.createUniPayAPIProfile();
                profile.getFirstPartyEmail = subject;
                profile.Environment        = stage;
                return(profile);
            }
            else
            {
                IAPIProfile profile = ProfileFactory.createSSLAPIProfile();
                profile.APIUsername        = apiUsername;
                profile.APIPassword        = apiPassword;
                profile.Environment        = stage;
                profile.CertificateFile    = CertificateFile_Cer;
                profile.PrivateKeyPassword = PrivateKeyPassword_Cer;
                profile.Subject            = subject;

                return(profile);
            }
        }
예제 #3
0
        public string GetBalanceCode()
        {
            NVPCallerServices caller  = new NVPCallerServices();
            IAPIProfile       profile = ProfileFactory.createSignatureAPIProfile();

            /*
             * WARNING: Do not embed plaintext credentials in your application code.
             * Doing so is insecure and against best practices.
             * Your API credentials must be handled securely. Please consider
             * encrypting them for use in any production environment, and ensure
             * that only authorized individuals may view or modify them.
             */
            profile.APIUsername  = "******";
            profile.APIPassword  = "******";
            profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
            profile.Environment  = "sandbox";
            caller.APIProfile    = profile;

            NVPCodec encoder = new NVPCodec();

            encoder["VERSION"] = "51.0";
            encoder["METHOD"]  = "GetBalance";
            string pStrrequestforNvp = encoder.Encode();
            string pStresponsenvp    = caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();

            decoder.Decode(pStresponsenvp);
            return(decoder["ACK"]);
        }
        public static NVPCallerServices PayPalAPIInitialize(bool isDev)
        {
            IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();

            if (isDev)
            {
                profile.APIUsername  = DEV_API_USERNAME;
                profile.APIPassword  = DEV_API_PASSWORD;
                profile.Environment  = DEV_ENVIRONMENT;
                profile.Subject      = String.Empty;
                profile.APISignature = DEV_API_SIGNATURE;
            }
            else
            {
                profile.APIUsername  = API_USERNAME;
                profile.APIPassword  = API_PASSWORD;
                profile.Environment  = ENVIRONMENT;
                profile.Subject      = String.Empty;
                profile.APISignature = API_SIGNATURE;
            }


            NVPCallerServices caller = new NVPCallerServices();

            caller.APIProfile = profile;

            return(caller);
        }
        public NVPCodec ECDoExpressCheckoutCode(string token, string payerID, string amount, string paymentType, string currencyCode)
        {
            NVPCallerServices caller  = new NVPCallerServices();
            IAPIProfile       profile = ProfileFactory.createSignatureAPIProfile();

            /*
             * WARNING: Do not embed plaintext credentials in your application code.
             * Doing so is insecure and against best practices.
             * Your API credentials must be handled securely. Please consider
             * encrypting them for use in any production environment, and ensure
             * that only authorized individuals may view or modify them.
             */

            // Set up your API credentials, PayPal end point, API operation and version.
            if (System.Configuration.ConfigurationManager.AppSettings["ENVIRONMENT"].ToString() == "T")
            {
                profile.APIUsername  = "******";
                profile.APIPassword  = "******";
                profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
                profile.Environment  = "sandbox";
            }
            else if (System.Configuration.ConfigurationManager.AppSettings["ENVIRONMENT"].ToString() == "L")
            {
                profile.APIUsername  = "******";
                profile.APIPassword  = "******";
                profile.APISignature = "AFcWxV21C7fd0v3bYYYRCpSSRl31Ab5GxWPc-1XSb8rJctwNCFHIYb84";
                profile.Environment  = "live";
            }
            else
            {
                profile.APIUsername  = "******";
                profile.APIPassword  = "******";
                profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
                profile.Environment  = "sandbox";
            }
            caller.APIProfile = profile;

            NVPCodec encoder = new NVPCodec();

            encoder["VERSION"] = "65.1";
            encoder["METHOD"]  = "DoExpressCheckoutPayment";

            // Add request-specific fields to the request.
            // Pass the token returned in SetExpressCheckout.
            encoder["TOKEN"]         = token;
            encoder["PAYERID"]       = payerID;
            encoder["AMT"]           = amount;
            encoder["PAYMENTACTION"] = paymentType;
            encoder["CURRENCYCODE"]  = currencyCode;

            // Execute the API operation and obtain the response.
            string pStrrequestforNvp = encoder.Encode();
            string pStresponsenvp    = caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();

            decoder.Decode(pStresponsenvp);
            return(decoder);
        }
예제 #6
0
        public string MassPayCode(string emailSubject, string receiverType, string currencyCode, string ReceiverEmail0, string amount0, string UniqueID0, string Note0, string ReceiverEmail1, string amount1, string UniqueID1, string Note1)
        {
            NVPCallerServices caller  = new NVPCallerServices();
            IAPIProfile       profile = ProfileFactory.createSignatureAPIProfile();

            /*
             * WARNING: Do not embed plaintext credentials in your application code.
             * Doing so is insecure and against best practices.
             * Your API credentials must be handled securely. Please consider
             * encrypting them for use in any production environment, and ensure
             * that only authorized individuals may view or modify them.
             */

            // Set up your API credentials, PayPal end point, API operation and version.
            profile.APIUsername  = "******";
            profile.APIPassword  = "******";
            profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
            profile.Environment  = "sandbox";
            caller.APIProfile    = profile;

            NVPCodec encoder = new NVPCodec();

            encoder["VERSION"] = "51.0";
            encoder["METHOD"]  = "MassPay";

            // Add request-specific fields to the request.
            encoder["EMAILSUBJECT"] = emailSubject;
            encoder["RECEIVERTYPE"] = receiverType;
            encoder["CURRENCYCODE"] = currencyCode;

            if (ReceiverEmail0.Length > 0)
            {
                encoder["L_EMAIL0"]    = ReceiverEmail0;
                encoder["L_Amt0"]      = amount0;
                encoder["L_UNIQUEID0"] = UniqueID0;
                encoder["L_NOTE0"]     = Note0;
            }

            if (ReceiverEmail1.Length > 0)
            {
                encoder["L_EMAIL1"]    = ReceiverEmail1;
                encoder["L_Amt1"]      = amount1;
                encoder["L_UNIQUEID1"] = UniqueID1;
                encoder["L_NOTE1"]     = Note1;
            }



            // Execute the API operation and obtain the response.
            string pStrrequestforNvp = encoder.Encode();
            string pStresponsenvp    = caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();

            decoder.Decode(pStresponsenvp);
            return(decoder["ACK"]);
        }
예제 #7
0
        public Hashtable DoDirectPaymentCode()
        {
            NVPCallerServices caller  = new NVPCallerServices();
            IAPIProfile       profile = ProfileFactory.createSignatureAPIProfile();

            /*
             * WARNING: Do not embed plaintext credentials in your application code.
             * Doing so is insecure and against best practices.
             * Your API credentials must be handled securely. Please consider
             * encrypting them for use in any production environment, and ensure
             * that only authorized individuals may view or modify them.
             */

            // Set up your API credentials, PayPal end point, API operation and version.
            profile.APIUsername  = Constants.PayPal_Username;       //"sdk-three_api1.sdk.com";
            profile.APIPassword  = Constants.PayPal_Password;       //"QFZCWN5HZM8VBG7Q";
            profile.APISignature = Constants.PayPal_Signature;      //"AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
            profile.Environment  = Constants.PayPal_PaymentAccount; //"live";// "sandbox";
            caller.APIProfile    = profile;

            NVPCodec encoder = new NVPCodec();

            encoder["VERSION"] = "51.0";
            encoder["METHOD"]  = "DoDirectPayment";

            // Add request-specific fields to the request.
            encoder["PAYMENTACTION"]  = "Sale"; //paymentAction;
            encoder["AMT"]            = fPaymentOrderTotal.ToString();
            encoder["CREDITCARDTYPE"] = (sCCType.Equals(CreditCardType.AmericanExpress)) ? "Amex" : sCCType.ToString();
            encoder["ACCT"]           = CCNumber;
            encoder["EXPDATE"]        = sCCExpDate;
            encoder["CVV2"]           = sCCVerificationCode;
            encoder["FIRSTNAME"]      = sCCOwnerFirstName;
            encoder["LASTNAME"]       = sCCOwnerLastName;
            encoder["STREET"]         = (sCCOwnerStreet2.Trim().Length > 0) ? string.Concat(sCCOwnerStreet1, ", ", sCCOwnerStreet2) : sCCOwnerStreet1;
            encoder["CITY"]           = sCCOwnerCityName;
            encoder["STATE"]          = sCCOwnerStateOrProvince;
            encoder["ZIP"]            = sCCOwnerPostalCode;
            encoder["COUNTRYCODE"]    = sCCOwnerCountryCode;
            encoder["CURRENCYCODE"]   = "USD";

            // Execute the API operation and obtain the response.
            string pStrrequestforNvp = encoder.Encode();
            string pStresponsenvp    = caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();

            decoder.Decode(pStresponsenvp);

            Hashtable htResult = new Hashtable();

            foreach (string st in decoder.AllKeys)
            {
                htResult.Add(st, decoder[st]);
            }
            return(htResult);
        }
예제 #8
0
        public static IAPIProfile CreateAPIProfile(string apiUsername, string apiPassword, string signature, string environment)
        {
            IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();

            profile.APIUsername  = apiUsername;
            profile.APIPassword  = apiPassword;
            profile.APISignature = signature;
            profile.Environment  = environment;
            return(profile);
        }
예제 #9
0
        /// <summary>
        /// 初始化APIProfile
        /// </summary>
        /// <returns></returns>
        private IAPIProfile CreateProfile()
        {
            IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();

            profile.APIUsername  = base.CurrentSiteSetting.PayPalAPIAccountName;     // Himall.Web.Framework.ServiceHelper.Create<Himall.IServices.IHimall_DictionariesService>().GetValueBYKey("PayPalAPIAccountName");
            profile.APIPassword  = base.CurrentSiteSetting.PayPalAPIAccountPassword; //Himall.Web.Framework.ServiceHelper.Create<Himall.IServices.IHimall_DictionariesService>().GetValueBYKey("PayPalAPIAccountPassword");
            profile.APISignature = base.CurrentSiteSetting.PayPalAPISignature;       //Himall.Web.Framework.ServiceHelper.Create<Himall.IServices.IHimall_DictionariesService>().GetValueBYKey("PayPalAPISignature");
            profile.Environment  = base.CurrentSiteSetting.PayPalEnvenment;          //Himall.Web.Framework.ServiceHelper.Create<Himall.IServices.IHimall_DictionariesService>().GetValueBYKey("PayPalEnvenment");
            profile.Subject      = "";
            return(profile);
        }
예제 #10
0
        /// <summary>
        /// 初始化APIProfile
        /// </summary>
        /// <returns></returns>
        private static IAPIProfile CreateProfile()
        {
            IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();

            profile.APIUsername  = ChemCloud.Web.Framework.ServiceHelper.Create <ChemCloud.IServices.IChemCloud_DictionariesService>().GetValueBYKey("PalPalUserName");
            profile.APIPassword  = ChemCloud.Web.Framework.ServiceHelper.Create <ChemCloud.IServices.IChemCloud_DictionariesService>().GetValueBYKey("PayPalPassword");
            profile.APISignature = ChemCloud.Web.Framework.ServiceHelper.Create <ChemCloud.IServices.IChemCloud_DictionariesService>().GetValueBYKey("PayPalSinature");
            profile.Environment  = ChemCloud.Web.Framework.ServiceHelper.Create <ChemCloud.IServices.IChemCloud_DictionariesService>().GetValueBYKey("PayPalEnvenment");
            profile.Subject      = "";
            return(profile);
        }
예제 #11
0
        /// <summary>
        /// 初始化APIProfile
        /// </summary>
        /// <returns></returns>
        private static IAPIProfile CreateProfile()
        {
            IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();

            profile.APIUsername  = ConfigurationManager.AppSettings["APIUserName"];
            profile.APIPassword  = ConfigurationManager.AppSettings["APIPassword"];
            profile.APISignature = ConfigurationManager.AppSettings["APISinature"];
            profile.Environment  = ConfigurationManager.AppSettings["Environment"];
            profile.Subject      = "";
            return(profile);
        }
예제 #12
0
    public static IAPIProfile CreateAPIProfile(string apiUsername, string apiPassword, string signature, string CertificateFile_Cer, string PrivateKeyPassword_Cer)
    {
        IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();

        profile.APIUsername = apiUsername;
        profile.APIPassword = apiPassword;
        profile.Environment = Constants.ENVIRONMENT;

        profile.Subject      = string.Empty;
        profile.APISignature = signature;
        return(profile);
    }
예제 #13
0
        public string CreateRecurringPaymentsProfileCode(string token, DateTime date, string amount, int BF, BillingPeriodType BP, CurrencyCodeType currencyCodeType)
        {
            CallerServices caller = new CallerServices();

            IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();

            /*
             * WARNING: Do not embed plaintext credentials in your application code.
             * Doing so is insecure and against best practices.
             * Your API credentials must be handled securely. Please consider
             * encrypting them for use in any production environment, and ensure
             * that only authorized individuals may view or modify them.
             */

            // Set up your API credentials, PayPal end point, and API version.
            profile.APIUsername  = "******";
            profile.APIPassword  = "******";
            profile.APISignature = "AsaWhdg.F1DEJUmkrAOGADAhmx2zAhz6qMKqOp5lTasZcyA1TAVoQrzO";
            profile.Environment  = "live";

            caller.APIProfile = profile;

            // Create the request object.



            CreateRecurringPaymentsProfileRequestType pp_request = new CreateRecurringPaymentsProfileRequestType();

            pp_request.Version = "51.0";



            // Add request-specific fields to the request.
            pp_request.CreateRecurringPaymentsProfileRequestDetails       = new CreateRecurringPaymentsProfileRequestDetailsType();
            pp_request.CreateRecurringPaymentsProfileRequestDetails.Token = "";
            pp_request.CreateRecurringPaymentsProfileRequestDetails.RecurringPaymentsProfileDetails = new RecurringPaymentsProfileDetailsType();
            pp_request.CreateRecurringPaymentsProfileRequestDetails.RecurringPaymentsProfileDetails.BillingStartDate = date;
            pp_request.CreateRecurringPaymentsProfileRequestDetails.ScheduleDetails = new ScheduleDetailsType();
            pp_request.CreateRecurringPaymentsProfileRequestDetails.ScheduleDetails.PaymentPeriod                   = new BillingPeriodDetailsType();
            pp_request.CreateRecurringPaymentsProfileRequestDetails.ScheduleDetails.PaymentPeriod.Amount            = new BasicAmountType();
            pp_request.CreateRecurringPaymentsProfileRequestDetails.ScheduleDetails.PaymentPeriod.Amount.Value      = amount;
            pp_request.CreateRecurringPaymentsProfileRequestDetails.ScheduleDetails.PaymentPeriod.Amount.currencyID = currencyCodeType; //Enum for currency code is  CurrencyCodeType.USD
            pp_request.CreateRecurringPaymentsProfileRequestDetails.ScheduleDetails.PaymentPeriod.BillingFrequency  = BF;
            pp_request.CreateRecurringPaymentsProfileRequestDetails.ScheduleDetails.PaymentPeriod.BillingPeriod     = BP;               ////Enum for BillingPeriod is  BillingPeriodType.Day

            // Execute the API operation and obtain the response.
            CreateRecurringPaymentsProfileResponseType pp_response = new CreateRecurringPaymentsProfileResponseType();

            pp_response = (CreateRecurringPaymentsProfileResponseType)caller.Call("CreateRecurringPaymentsProfile", pp_request);
            return(pp_response.Errors[0].LongMessage);
        }
예제 #14
0
        public string DoDirectPaymentCode(string paymentAction, string amount, string creditCardType, string creditCardNumber, string expdate_month, string cvv2Number, string firstName, string lastName, string address1, string city, string state, string zip, string countryCode, string currencyCode)
        {
            NVPCallerServices caller  = new NVPCallerServices();
            IAPIProfile       profile = ProfileFactory.createSignatureAPIProfile();

            /*
             * WARNING: Do not embed plaintext credentials in your application code.
             * Doing so is insecure and against best practices.
             * Your API credentials must be handled securely. Please consider
             * encrypting them for use in any production environment, and ensure
             * that only authorized individuals may view or modify them.
             */

            // Set up your API credentials, PayPal end point, API operation and version.
            profile.APIUsername  = "******";                //"sdk-three_api1.sdk.com";
            profile.APIPassword  = "******";                                               //"QFZCWN5HZM8VBG7Q";
            profile.APISignature = "Aodyho-T1mAnue23UgKnw1JPD8E9AnPQgwCa26tyq818j5Kv.mh7AdxZ"; //"AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
            profile.Environment  = "sandbox";
            caller.APIProfile    = profile;

            NVPCodec encoder = new NVPCodec();

            encoder["VERSION"] = "51.0";
            encoder["METHOD"]  = "DoDirectPayment";

            // Add request-specific fields to the request.
            encoder["PAYMENTACTION"]  = paymentAction;
            encoder["AMT"]            = amount;
            encoder["CREDITCARDTYPE"] = creditCardType;
            encoder["ACCT"]           = creditCardNumber;
            encoder["EXPDATE"]        = expdate_month;
            encoder["CVV2"]           = cvv2Number;
            encoder["FIRSTNAME"]      = firstName;
            encoder["LASTNAME"]       = lastName;
            encoder["STREET"]         = address1;
            encoder["CITY"]           = city;
            encoder["STATE"]          = state;
            encoder["ZIP"]            = zip;
            encoder["COUNTRYCODE"]    = countryCode;
            encoder["CURRENCYCODE"]   = currencyCode;

            // Execute the API operation and obtain the response.
            string pStrrequestforNvp = encoder.Encode();
            string pStresponsenvp    = caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();

            decoder.Decode(pStresponsenvp);
            return(decoder["ACK"]);
        }
예제 #15
0
        private NVPCallerServices GetPayPalNVPCaller(PaymentMethod paymentMethod)
        {
            // var callerServices = new com.paypal.sdk.services.CallerServices();
            var caller = new NVPCallerServices();

            IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();

            profile.Environment  = paymentMethod.DynamicProperty <bool>().Sandbox ? "sandbox" : "live";
            profile.APIPassword  = paymentMethod.DynamicProperty <string>().ApiPassword;
            profile.APISignature = paymentMethod.DynamicProperty <string>().ApiSignature;
            profile.APIUsername  = paymentMethod.DynamicProperty <string>().ApiUsername;

            caller.APIProfile = profile;
            return(caller);
        }
예제 #16
0
        private PayPalAPI CreatePaypalAPI()
        {
            var profile = ProfileFactory.createSignatureAPIProfile();

            if (profile != null)
            {
                profile.APIUsername  = Settings.PayPalUserName;
                profile.APIPassword  = Settings.PayPalPassword;
                profile.Subject      = string.Empty;
                profile.Environment  = Settings.PayPalMode;
                profile.APISignature = Settings.PayPalSignature;
            }
            else
            {
                throw new ArgumentException("Paypal com.paypal.sdk.profiles.ProfileFactory.CreateAPIProfile has failed.");
            }
            return(new PayPalAPI(profile));
        }
예제 #17
0
        public string RefundTransactionCode(String refundType, String transactionId, String amount, String note, String currencyCode)
        {
            NVPCallerServices caller  = new NVPCallerServices();
            IAPIProfile       profile = ProfileFactory.createSignatureAPIProfile();

            /*
             * WARNING: Do not embed plaintext credentials in your application code.
             * Doing so is insecure and against best practices.
             * Your API credentials must be handled securely. Please consider
             * encrypting them for use in any production environment, and ensure
             * that only authorized individuals may view or modify them.
             */

            // Set up your API credentials, PayPal end point, API operation and version.
            profile.APIUsername  = "******";
            profile.APIPassword  = "******";
            profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
            profile.Environment  = "sandbox";
            caller.APIProfile    = profile;

            NVPCodec encoder = new NVPCodec();

            encoder["VERSION"] = "51.0";
            encoder["METHOD"]  = "RefundTransaction";

            // Add request-specific fields to the request.
            encoder["TRANSACTIONID"] = transactionId;
            if (refundType != "Full")
            {
                encoder["AMT"]  = amount;
                encoder["NOTE"] = note;
            }
            encoder["REFUNDTYPE"] = refundType;


            // Execute the API operation and obtain the response.
            string pStrrequestforNvp = encoder.Encode();
            string pStresponsenvp    = caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();

            decoder.Decode(pStresponsenvp);
            return(decoder["ACK"]);
        }
        public string ECDoExpressCheckoutCode(string token, string payerID, string amount, string paymentType, string currencyCode)
        {
            NVPCallerServices caller  = new NVPCallerServices();
            IAPIProfile       profile = ProfileFactory.createSignatureAPIProfile();

            /*
             * WARNING: Do not embed plaintext credentials in your application code.
             * Doing so is insecure and against best practices.
             * Your API credentials must be handled securely. Please consider
             * encrypting them for use in any production environment, and ensure
             * that only authorized individuals may view or modify them.
             */

            // Set up your API credentials, PayPal end point, API operation and version.
            profile.APIUsername  = "******";
            profile.APIPassword  = "******";
            profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
            profile.Environment  = "sandbox";
            caller.APIProfile    = profile;

            NVPCodec encoder = new NVPCodec();

            encoder["VERSION"] = "51.0";
            encoder["METHOD"]  = "DoExpressCheckoutPayment";

            // Add request-specific fields to the request.
            // Pass the token returned in SetExpressCheckout.
            encoder["TOKEN"]         = token;
            encoder["PAYERID"]       = payerID;
            encoder["AMT"]           = amount;
            encoder["PAYMENTACTION"] = paymentType;
            encoder["CURRENCYCODE"]  = currencyCode;

            // Execute the API operation and obtain the response.
            string pStrrequestforNvp = encoder.Encode();
            string pStresponsenvp    = caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();

            decoder.Decode(pStresponsenvp);
            return(decoder["ACK"]);
        }
예제 #19
0
        public string TransactionSearchCode(string startDate, string endDate, string transactionID)
        {
            NVPCallerServices caller  = new NVPCallerServices();
            IAPIProfile       profile = ProfileFactory.createSignatureAPIProfile();

            /*
             * WARNING: Do not embed plaintext credentials in your application code.
             * Doing so is insecure and against best practices.
             * Your API credentials must be handled securely. Please consider
             * encrypting them for use in any production environment, and ensure
             * that only authorized individuals may view or modify them.
             */

            // Set up your API credentials, PayPal end point, API operation and version.
            profile.APIUsername  = "******";
            profile.APIPassword  = "******";
            profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
            profile.Environment  = "sandbox";
            caller.APIProfile    = profile;

            NVPCodec encoder = new NVPCodec();

            encoder["VERSION"] = "51.0";
            encoder["METHOD"]  = "TransactionSearch";

            // Add request-specific fields to the request.
            encoder["TRXTYPE"]       = "Q";        //Date format from server 2006-9-6T0:0:0
            encoder["STARTDATE"]     = startDate + "T0:0:0";
            encoder["ENDDATE"]       = endDate + "T23:59:59";
            encoder["TRANSACTIONID"] = transactionID;


            // Execute the API operation and obtain the response.
            string pStrrequestforNvp = encoder.Encode();
            string pStresponsenvp    = caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();

            decoder.Decode(pStresponsenvp);
            return(decoder["ACK"]);
        }
예제 #20
0
        public string CreateRecurringPaymentsProfileCode(string token, string amount, string profileDate, string billingPeriod, string billingFrequency)
        {
            NVPCallerServices caller  = new NVPCallerServices();
            IAPIProfile       profile = ProfileFactory.createSignatureAPIProfile();

            /*
             * WARNING: Do not embed plaintext credentials in your application code.
             * Doing so is insecure and against best practices.
             * Your API credentials must be handled securely. Please consider
             * encrypting them for use in any production environment, and ensure
             * that only authorized individuals may view or modify them.
             */
            // Set up your API credentials, PayPal end point, API operation and version.
            profile.APIUsername  = "******";
            profile.APIPassword  = "******";
            profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
            profile.Environment  = "sandbox";
            caller.APIProfile    = profile;

            NVPCodec encoder = new NVPCodec();

            encoder["VERSION"] = "51.0";

            // Add request-specific fields to the request.
            encoder["METHOD"]           = "CreateRecurringPaymentsProfile";
            encoder["TOKEN"]            = token;
            encoder["AMT"]              = amount;
            encoder["PROFILESTARTDATE"] = profileDate;                  //Date format from server expects Ex: 2006-9-6T0:0:0
            encoder["BILLINGPERIOD"]    = billingPeriod;
            encoder["BILLINGFREQUENCY"] = billingFrequency;

            // Execute the API operation and obtain the response.
            string pStrrequestforNvp = encoder.Encode();
            string pStresponsenvp    = caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();

            decoder.Decode(pStresponsenvp);
            return(decoder["ACK"]);
        }
        public string SetCustomerBillingAgreementCode(string returnURL, string cancelURL, string billingDesc)
        {
            NVPCallerServices caller  = new NVPCallerServices();
            IAPIProfile       profile = ProfileFactory.createSignatureAPIProfile();

            /*
             * WARNING: Do not embed plaintext credentials in your application code.
             * Doing so is insecure and against best practices.
             * Your API credentials must be handled securely. Please consider
             * encrypting them for use in any production environment, and ensure
             * that only authorized individuals may view or modify them.
             */

            // Set up your API credentials, PayPal end point, API operation and version.
            profile.APIUsername  = "******";
            profile.APIPassword  = "******";
            profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
            profile.Environment  = "sandbox";
            caller.APIProfile    = profile;

            NVPCodec encoder = new NVPCodec();

            encoder["VERSION"] = "51.0";
            encoder["METHOD"]  = "SetCustomerBillingAgreement";

            // Add request-specific fields to the request.
            encoder["RETURNURL"]   = returnURL;
            encoder["CANCELURL"]   = cancelURL;
            encoder["BILLINGTYPE"] = "RecurringPayments";
            encoder["BILLINGAGREEMENTDESCRIPTION"] = billingDesc;

            // Execute the API operation and obtain the response.
            string pStrrequestforNvp = encoder.Encode();
            string pStresponsenvp    = caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();

            decoder.Decode(pStresponsenvp);
            return(decoder["ACK"]);
        }
예제 #22
0
        public string ECSetExpressCheckout_PayLaterCode(string returnURL, string cancelURL, string amount, string paymentType, string currencyCode)
        {
            NVPCallerServices caller  = new NVPCallerServices();
            IAPIProfile       profile = ProfileFactory.createSignatureAPIProfile();

            /*
             * WARNING: Do not embed plaintext credentials in your application code.
             * Doing so is insecure and against best practices.
             * Your API credentials must be handled securely. Please consider
             * encrypting them for use in any production environment, and ensure
             * that only authorized individuals may view or modify them.
             */
            profile.APIUsername  = "******";
            profile.APIPassword  = "******";
            profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
            profile.Environment  = "sandbox";
            caller.APIProfile    = profile;

            NVPCodec encoder = new NVPCodec();

            encoder["VERSION"]       = "51.0";
            encoder["METHOD"]        = "SetExpressCheckout";
            encoder["RETURNURL"]     = returnURL;
            encoder["CANCELURL"]     = cancelURL;
            encoder["AMT"]           = amount;
            encoder["PAYMENTACTION"] = paymentType;
            encoder["CURRENCYCODE"]  = currencyCode;
            encoder["L_PROMOCODE0"]  = "101";
            string pStrrequestforNvp = encoder.Encode();
            string pStresponsenvp    = caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();

            decoder.Decode(pStresponsenvp);
            return(decoder["ACK"]);
        }