DoExpressCheckoutPayment返回错误11623

时间:2014-05-01 21:20:03

标签: c# paypal

我是PayPal API的新用户。我在调用DoExpressCheckoutPayment时遇到错误。错误是11623"此帐户未获得授权服务的批准。"。沙盒帐户无法正常工作并且需要一些额外的非显而易见的设置步骤是正常的吗?

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

这里是序列化为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>

1 个答案:

答案 0 :(得分:2)

问题是您在SetExpressCheckout中指定 SALE 作为 PaymentAction ,然后在DoExpressCheckout中指定订单如果你在Set call中指定它,它需要 SALE

来自Developer Site

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