c# - DoExpressCheckoutPayment 返回错误 11623

标签 c# paypal

我是 PayPal API 的新手。我在调用 DoExpressCheckoutPayment 时遇到错误。错误是 11623 “此帐户未被批准用于授权服务。”。沙盒帐户无法使用并需要一些额外的非显而易见的设置步骤是否正常?

在我的测试应用程序中,对 SetExpressCheckout 和 GetExpressCheckoutDetails 的调用似乎有效。我正在使用 C# 和依赖于 PayPalCoreSDK 1.4.1.0 的 PayPal Merchant SDK (2.7.109.0) NuGet 包。我正在使用基于 C# 对象的 API,它根据 fiddler2 向 PayPal 沙箱 URL 发送/接收 SOAP 消息。

这是序列化为 XML 的完整系列请求/响应消息(请注意,我不是直接发送/接收这些 XML 文档,我只是序列化请求/响应对象以了解 API 接受和返回的内容.

<?xml version="1.0" encoding="utf-16"?>
<SetExpressCheckoutReq xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <SetExpressCheckoutRequest>
    <DetailLevel />
    <Version>104.0</Version>
    <SetExpressCheckoutRequestDetails>
      <ReturnURL>http://localhost:50405/PayPalOrderComplete.aspx</ReturnURL>
      <CancelURL>http://localhost:50405/PayPalOrderCanceled.aspx</CancelURL>
      <PaymentAction xsi:nil="true" />
      <SolutionType xsi:nil="true" />
      <LandingPage xsi:nil="true" />
      <ChannelType xsi:nil="true" />
      <BillingAgreementDetails />
      <PromoCodes />
      <ProductCategory xsi:nil="true" />
      <ShippingMethod xsi:nil="true" />
      <OtherPaymentMethods />
      <PaymentDetails>
        <PaymentDetailsType>
          <OrderTotal>
            <currencyID>USD</currencyID>
            <value>1.00</value>
          </OrderTotal>
          <ButtonSource>PayPal_SDK</ButtonSource>
          <PaymentCategoryType xsi:nil="true" />
          <ShippingMethod xsi:nil="true" />
          <PaymentDetailsItem>
            <PaymentDetailsItemType>
              <Name>item</Name>
              <Quantity>1</Quantity>
              <Amount>
                <currencyID>USD</currencyID>
                <value>1.00</value>
              </Amount>
              <ProductCategory xsi:nil="true" />
              <ItemCategory>PHYSICAL</ItemCategory>
            </PaymentDetailsItemType>
          </PaymentDetailsItem>
          <AllowedPaymentMethod xsi:nil="true" />
          <PaymentAction>SALE</PaymentAction>
          <BranchLevel xsi:nil="true" />
          <Recurring xsi:nil="true" />
          <PaymentReason xsi:nil="true" />
        </PaymentDetailsType>
      </PaymentDetails>
      <FlatRateShippingOptions />
      <SurveyChoice />
      <TotalType xsi:nil="true" />
      <Incentives />
      <CoupledBuckets />
    </SetExpressCheckoutRequestDetails>
  </SetExpressCheckoutRequest>
</SetExpressCheckoutReq>

<?xml version="1.0" encoding="utf-16"?>
<SetExpressCheckoutResponseType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Timestamp>2014-05-01T20:57:21Z</Timestamp>
  <Ack>SUCCESS</Ack>
  <CorrelationID>6d48820c828cf</CorrelationID>
  <Errors />
  <Version>104.0</Version>
  <Build>10800277</Build>
  <Token>EC-51L81221B55825817</Token>
</SetExpressCheckoutResponseType>

<?xml version="1.0" encoding="utf-16"?>
<GetExpressCheckoutDetailsReq xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <GetExpressCheckoutDetailsRequest>
    <DetailLevel />
    <Version>104.0</Version>
    <Token>EC-51L81221B55825817</Token>
  </GetExpressCheckoutDetailsRequest>
</GetExpressCheckoutDetailsReq>

<?xml version="1.0" encoding="utf-16"?>
<GetExpressCheckoutDetailsResponseType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Timestamp>2014-05-01T20:58:49Z</Timestamp>
  <Ack>SUCCESS</Ack>
  <CorrelationID>b1afb2282b2f2</CorrelationID>
  <Errors />
  <Version>104.0</Version>
  <Build>10800277</Build>
  <GetExpressCheckoutDetailsResponseDetails>
    <Token>EC-51L81221B55825817</Token>
    <PayerInfo>
      <Payer>paypal.buyer1@iantaite.com</Payer>
      <PayerID>B7QPX4VTH7CEU</PayerID>
      <PayerStatus>VERIFIED</PayerStatus>
      <PayerName>
        <FirstName>Ian</FirstName>
        <LastName>Taite</LastName>
      </PayerName>
      <PayerCountry>NZ</PayerCountry>
      <Address>
        <Name>Ian Taite</Name>
        <Street1>123 Sample St</Street1>
        <CityName>Wellington</CityName>
        <Country>NZ</Country>
        <CountryName>New Zealand</CountryName>
        <PostalCode>6004</PostalCode>
        <AddressOwner>PAYPAL</AddressOwner>
        <AddressStatus>UNCONFIRMED</AddressStatus>
        <AddressNormalizationStatus xsi:nil="true" />
      </Address>
    </PayerInfo>
    <BillingAgreementAcceptedStatus xsi:nil="true" />
    <CheckoutStatus>PaymentActionNotInitiated</CheckoutStatus>
    <PaymentDetails>
      <PaymentDetailsType>
        <OrderTotal>
          <currencyID>USD</currencyID>
          <value>1.00</value>
        </OrderTotal>
        <ItemTotal>
          <currencyID>USD</currencyID>
          <value>1.00</value>
        </ItemTotal>
        <ShippingTotal>
          <currencyID>USD</currencyID>
          <value>0.00</value>
        </ShippingTotal>
        <HandlingTotal>
          <currencyID>USD</currencyID>
          <value>0.00</value>
        </HandlingTotal>
        <TaxTotal>
          <currencyID>USD</currencyID>
          <value>0.00</value>
        </TaxTotal>
        <ButtonSource>PayPal_SDK</ButtonSource>
        <ShipToAddress>
          <Name>Ian Taite</Name>
          <Street1>123 Sample St</Street1>
          <CityName>Wellington</CityName>
          <Country>NZ</Country>
          <CountryName>New Zealand</CountryName>
          <PostalCode>6004</PostalCode>
          <AddressOwner>PAYPAL</AddressOwner>
          <AddressStatus>UNCONFIRMED</AddressStatus>
          <AddressNormalizationStatus>NONE</AddressNormalizationStatus>
        </ShipToAddress>
        <PaymentCategoryType xsi:nil="true" />
        <ShippingMethod xsi:nil="true" />
        <PaymentDetailsItem>
          <PaymentDetailsItemType>
            <Name>item</Name>
            <Quantity>1</Quantity>
            <Tax>
              <currencyID>USD</currencyID>
              <value>0.00</value>
            </Tax>
            <Amount>
              <currencyID>USD</currencyID>
              <value>1.00</value>
            </Amount>
            <ProductCategory xsi:nil="true" />
            <ItemCategory>PHYSICAL</ItemCategory>
          </PaymentDetailsItemType>
        </PaymentDetailsItem>
        <InsuranceTotal>
          <currencyID>USD</currencyID>
          <value>0.00</value>
        </InsuranceTotal>
        <ShippingDiscount>
          <currencyID>USD</currencyID>
          <value>0.00</value>
        </ShippingDiscount>
        <InsuranceOptionOffered>false</InsuranceOptionOffered>
        <AllowedPaymentMethod xsi:nil="true" />
        <PaymentAction xsi:nil="true" />
        <BranchLevel xsi:nil="true" />
        <Recurring xsi:nil="true" />
        <PaymentReason xsi:nil="true" />
      </PaymentDetailsType>
    </PaymentDetails>
    <IncentiveDetails />
    <SurveyChoiceSelected />
    <PaymentRequestInfo>
      <PaymentRequestInfoType />
    </PaymentRequestInfo>
  </GetExpressCheckoutDetailsResponseDetails>
</GetExpressCheckoutDetailsResponseType>

<?xml version="1.0" encoding="utf-16"?>
<DoExpressCheckoutPaymentReq xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <DoExpressCheckoutPaymentRequest>
    <DetailLevel />
    <DoExpressCheckoutPaymentRequestDetails>
      <PaymentAction xsi:nil="true" />
      <Token>EC-51L81221B55825817</Token>
      <PayerID>B7QPX4VTH7CEU</PayerID>
      <PaymentDetails>
        <PaymentDetailsType>
          <OrderTotal>
            <currencyID>USD</currencyID>
            <value>1.00</value>
          </OrderTotal>
          <ButtonSource>PayPal_SDK</ButtonSource>
          <PaymentCategoryType xsi:nil="true" />
          <ShippingMethod xsi:nil="true" />
          <PaymentDetailsItem />
          <AllowedPaymentMethod xsi:nil="true" />
          <SellerDetails>
            <PayPalAccountID>paypal.merchant1_api1.iantaite.com</PayPalAccountID>
          </SellerDetails>
          <PaymentAction>ORDER</PaymentAction>
          <PaymentRequestID>PaymentRequest1</PaymentRequestID>
          <BranchLevel xsi:nil="true" />
          <Recurring xsi:nil="true" />
          <PaymentReason xsi:nil="true" />
        </PaymentDetailsType>
      </PaymentDetails>
      <SurveyChoiceSelected />
      <ButtonSource>PayPal_SDK</ButtonSource>
      <SkipBACreation xsi:nil="true" />
      <CoupledBuckets />
    </DoExpressCheckoutPaymentRequestDetails>
    <ReturnFMFDetails xsi:nil="true" />
  </DoExpressCheckoutPaymentRequest>
</DoExpressCheckoutPaymentReq>

<?xml version="1.0" encoding="utf-16"?>
<DoExpressCheckoutPaymentResponseType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Timestamp>2014-05-01T20:58:50Z</Timestamp>
  <Ack>FAILURE</Ack>
  <CorrelationID>a8d913d3b7c8e</CorrelationID>
  <Errors>
    <ErrorType>
      <ShortMessage>This account is not approved for the authorization service.</ShortMessage>
      <LongMessage>This account is not approved for the authorization service. To enable this service, contact PayPal customer service</LongMessage>
      <ErrorCode>11623</ErrorCode>
      <SeverityCode>ERROR</SeverityCode>
      <ErrorParameters />
    </ErrorType>
  </Errors>
  <Version>109.0</Version>
  <Build>10800277</Build>
</DoExpressCheckoutPaymentResponseType>

最佳答案

问题是您在SetExpressCheckout 中将SALE 指定为PaymentAction,然后在您的DoExpressCheckout .. 如果您在 Set 调用中指定它,则它需要是SALE

来自Developer Site :

您不能在 SetExpressCheckout 请求中将此字段设置为 Sale,然后在请求中将值更改为 Authorization 或 Order。如果您在 SetExpressCheckout 中将字段设置为 Authorization 或 Order,则可以将字段设置为 Sale。

关于c# - DoExpressCheckoutPayment 返回错误 11623,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23416820/

相关文章:

paypal - Omnipay/Paypal Gateway - 交易显示成功,而 Paypal 沙盒帐户不显示交易的债务/信用

c# - 如何使用方法 post 使用 HttpRequest 发送变量?

ruby-on-rails - Paypal Express ActiveMerchant 集成

paypal - 使用 `amount` 时,为什么应将 `Drop-In` 发送到 BrainTree PayPal 配置?

Paypal 定制用户结账

paypal - 使用 Paypal IPN 识别唯一的配置文件

c# - %= 运算符的作用是什么?

c# - 以编程方式设置 TextBlock 的样式

c# - 创建两个不会在 ASP.NET MVC 中生成 404 错误的路由的问题

c# - jquery ajax post 到 .aspx 页面加载 - 如何读取发布的变量?