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 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); } }
public string DoCaptureCode(string authorization_id, string amount) { CallerServices caller = new CallerServices(); IAPIProfile profile = ProfileFactory.createSSLAPIProfile(); profile.APIUsername = "******"; profile.APIPassword = "******"; profile.CertificateFile = @"~\MyTestCertificate.txt"; profile.Environment = "sandbox"; caller.APIProfile = profile; DoCaptureRequestType pp_request = new DoCaptureRequestType(); pp_request.Version = "51.0"; pp_request.AuthorizationID = authorization_id; pp_request.Amount = new BasicAmountType(); pp_request.Amount.Value = amount; pp_request.Amount.currencyID = CurrencyCodeType.GBP; pp_request.CompleteType = CompleteCodeType.Complete; DoCaptureResponseType pp_response = new DoCaptureResponseType(); pp_response = (DoCaptureResponseType)caller.Call("DoCapture", pp_request); return(pp_response.Ack.ToString()); }
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 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); }
/// <summary> /// 初始化支付服务器调用 /// </summary> /// <returns></returns> private NVPCallerServices InitializeServices() { NVPCallerServices service = new NVPCallerServices(); IAPIProfile profile = CreateProfile(); service.APIProfile = profile; return(service); }
public static GetTransactionDetailsResponseType GetTransactionDetails(string trxID, IAPIProfile api) { caller.APIProfile = api; GetTransactionDetailsRequestType concreteRequest = new GetTransactionDetailsRequestType(); concreteRequest.DetailLevel = new com.paypal.soap.api.DetailLevelCodeType[] { com.paypal.soap.api.DetailLevelCodeType.ReturnAll }; concreteRequest.TransactionID = trxID; return (GetTransactionDetailsResponseType)caller.Call("GetTransactionDetails", concreteRequest); }
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"]); }
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); }
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); }
/// <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); }
/// <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); }
/// <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); }
public PayPalAccountInfo(PayPalSettings settings, IAPIProfile profile, CallerServices caller) { this.settings = settings; this.caller = caller; profile.APIUsername = settings.Username; profile.APIPassword = settings.Password; profile.APISignature = settings.Signature; profile.Environment = settings.Environment; caller.APIProfile = profile; }
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); }
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); }
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"]); }
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); }
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"]); }
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"]); }
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"]); }
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 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"]); }
public static void SetDefaultProfile() { SessionProfile = DefaultProfile; }
public static GetTransactionDetailsResponseType GetTransactionDetails(string trxID, IAPIProfile api) { caller.APIProfile = api; GetTransactionDetailsRequestType concreteRequest = new GetTransactionDetailsRequestType(); concreteRequest.DetailLevel = new com.paypal.soap.api.DetailLevelCodeType[] { com.paypal.soap.api.DetailLevelCodeType.ReturnAll }; concreteRequest.TransactionID = trxID; return((GetTransactionDetailsResponseType)caller.Call("GetTransactionDetails", concreteRequest)); }
///// <summary> ///// Get Paypal country code ///// </summary> ///// <param name="country">Country</param> ///// <returns>Paypal country code</returns> //protected CountryCodeType GetPaypalCountryCodeType(Country country) //{ // CountryCodeType payerCountry = CountryCodeType.IN; // try // { // payerCountry = (CountryCodeType)Enum.Parse(typeof(CountryCodeType), country.TwoLetterIsoCode); // } // catch // { // } // return payerCountry; //} ///// <summary> ///// Get Paypal credit card type ///// </summary> ///// <param name="CreditCardType">Credit card type</param> ///// <returns>Paypal credit card type</returns> //protected CreditCardTypeType GetPaypalCreditCardType(string CreditCardType) //{ // CreditCardTypeType creditCardTypeType = (CreditCardTypeType)Enum.Parse(typeof(CreditCardTypeType), CreditCardType); // return creditCardTypeType; //} private void InitSettings() { APIAccountUsername = "******"; APIAccountPassword = "******"; APIAccountSignature = "AtP7rLd7TBR7eGbquoauyoA.T0bXAEgVPCgWRJ7.pbYP9lvnEWI2G4k6"; Environment = "sandbox"; //if (string.IsNullOrEmpty(APIAccountUsername)) // throw new NopException("Paypal Direct API Account Username is empty"); //if (string.IsNullOrEmpty(APIAccountPassword)) // throw new NopException("Paypal Direct API Account Password is empty"); //if (string.IsNullOrEmpty(APIAccountSignature)) // throw new NopException("Paypal Direct API Account Signature is empty"); caller = new CallerServices(); profile = ProfileFactory.createSignatureAPIProfile(); profile.APIUsername = APIAccountUsername; profile.APIPassword = APIAccountPassword; profile.APISignature = APIAccountSignature; profile.Environment = Environment; caller.APIProfile = profile; }
public PayPalAPI(IAPIProfile PayPalProfile) { caller = new CallerServices { APIProfile = PayPalProfile }; }