2014-05-01 36 views
1

我是PayPal API的新手。我收到一個錯誤,稱爲DoExpressCheckoutPayment。錯誤是11623「該帳戶未被批准用於授權服務。」沙盒帳戶無法正常工作並需要一些額外的非顯而易見的設置步驟?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>[email protected]</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> 

回答

2

問題是你在你的SetExpressCheckout指定銷售作爲PaymentAction然後在DoExpressCheckout指定ORDER ..它需要銷售,如果你用上在Set調用中指出這一點。

Developer Site

你不能將此字段設置爲銷售在SetExpressCheckout請求,然後更改請求中的值,以授權或訂購。如果您在SetExpressCheckout中將該字段設置爲授權或訂單,則可以將該字段設置爲銷售。

+0

謝謝。這是因爲使用了https://devtools-paypal.com/guide/expresscheckout/dotnet中的代碼示例以及GitHub的另一個代碼示例:https://github.com/paypal/codesamples-dotnet/blob/master /Merchant/DoExpressCheckoutPaymentSample.cs - 我之所以這麼做的唯一原因是因爲由於某種原因昨天在第5步中devtools頁面失敗。 – IanT8