简体   繁体   中英

Paypal Integration with mvc

I am integrating paypal using mvc C#. I am setting my web.config with the paypal section with the following code

<configSections>
    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="paypal" type="PayPal.SDKConfigHandler, PayPal" />
      <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
    </sectionGroup>
  </configSections>

  <!-- PayPal SDK settings -->
  <paypal>
    <settings>
      <add name="mode" value="sandbox"/>
      <add name="connectionTimeout" value="360000"/>
      <add name="requestRetries" value="1"/>
      <add name="clientId" value="my client id"/>
      <add name="clientSecret" value="my secret key"/>
    </settings>
  </paypal>

  <!--Configure logging using the log4net library-->
  <log4net>
    <appender name="FileAppender" type="log4net.Appender.FileAppender">
      <file value="PayPal.SDK.Sample.log"/>
      <appendToFile value="true"/>
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] %message%newline"/>
      </layout>
    </appender>
    <root>
      <level value="DEBUG"/>
      <appender-ref ref="FileAppender"/>
    </root>
  </log4net>

But when I run the application I get the following error

Unrecognized configuration section paypal

according to the documentation , section should be defined as follows:

<section name="paypal" type="PayPal.Manager.SDKConfigHandler, PayPalCoreSDK" />

which is different from what you have. See if that helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM