由于地址无效,PayPal DoDirectPayment(SOAP API)事务失败

时间:2013-03-22 19:57:41

标签: php paypal paypal-sandbox

我正在尝试将PayPal模块集成到我们基于osCommerce的网站中 - 这是一个使用PayPal DoDirectPayment(SOAP)API通过PayPal执行信用卡授权/付款的插件。到目前为止,我有:

  • 安装模块并使其正常工作
  • 在PayPal沙盒中设置启用PaymentsPro的商家帐户
  • 使用信用卡在Sandbox中创建了一个买方帐户
  • 已验证我们网站上的帐单邮寄地址与地址相符 存储在PayPal Sandbox中的买家帐户的信用卡

我能够一直完成结账流程;但每次事务失败时都会显示以下错误消息。

  

无效数据(10540)
  由于地址无效,无法处理交易。

我已经使用步骤调试(通过XDEBUG)来验证结帐表单中指定的地址信息是否已传递到cUrl请求中。在下面找到SOAP请求,因为它在发送前不久出现:

请注意,潜在的敏感信息已被更改;但我直接将PayPal Sandbox中的地址与我们网站上的地址进行了比较 - 它们是相同的,并且符合API文档here中列出的字段规范。第42页及以上

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <RequesterCredentials xmlns="urn:ebay:api:PayPalAPI">
      <Credentials xmlns="urn:ebay:apis:eBLBaseComponents">
        <Username>login_api1.company.com</Username>
        <Password>xxxxxxxxxxxxxxxx</Password>
        <Subject></Subject>
      </Credentials>
    </RequesterCredentials>
  </soap:Header>
  <soap:Body>
    <DoDirectPaymentReq xmlns="urn:ebay:api:PayPalAPI">
      <DoDirectPaymentRequest>
        <Version xmlns="urn:ebay:apis:eBLBaseComponents">2.0</Version>
        <DoDirectPaymentRequestDetails xmlns="urn:ebay:apis:eBLBaseComponents">
          <PaymentAction>Sale</PaymentAction>
          <PaymentDetails>
            <OrderTotal currencyID="USD">13.96</OrderTotal>
            <OrderDescription>Order placed on March 21, 2013, 2:01 pm by   (ID: xx339)</OrderDescription>
            <ItemTotal currencyID="USD">8.45</ItemTotal>
            <ShippingTotal currencyID="USD">4.51</ShippingTotal>
            <HandlingTotal currencyID="USD"></HandlingTotal>
            <TaxTotal currencyID="USD">1</TaxTotal>
            <Custom>Phone: xxx-xxx-xxxx -- Email: xxxxxxxxxx@gmail.com</Custom>
            <InvoiceID></InvoiceID>
            <NotifyURL></NotifyURL>
            <ButtonSource></ButtonSource>
            <ShipToAddress>
              <Name></Name>
              <Street1>1313 Park Forest</Street1>
              <Street2></Street2>
              <CityName>Batavia</CityName> 
              <StateOrProvince>OH</StateOrProvince>
              <PostalCode>45103</PostalCode>
              <Country>US</Country>
            </ShipToAddress>
            <PaymentDetailsItem>
                <Name>Custom Poker Deck</Name>
                <Amount currencyID="USD">5.67</Amount>
                <Number>-</Number>
                <Quantity>1</Quantity>
            </PaymentDetailsItem>
            <PaymentDetailsItem>
                <Name>BRAWL Deck</Name>
                <Amount currencyID="USD">3.78</Amount>
                <Number>-</Number>
                <Quantity>1</Quantity>
            </PaymentDetailsItem>
            <PaymentDetailsItem>
                <Name>Order Total Discrepancy</Name>
                <Amount currencyID="USD">-1.00</Amount>
                <Number>-</Number>
                <Quantity>1</Quantity>
            </PaymentDetailsItem>
          </PaymentDetails>
          <CreditCard>
            <CardOwner>
              <Payer>xxxxxxxxxx@gmail.com</Payer>
              <PayerName>
              <FirstName>John</FirstName>
              <LastName>Doe</LastName>
              </PayerName>
              <Address>
                <Street1>1313 Park Forest</Street1>
                <Street2></Street2>
                <CityName>Batavia</CityName> 
                <StateOrProvince>OH</StateOrProvince>
                <PostalCode>45103</PostalCode>
                <Country>US</Country>
              </Address>
            </CardOwner>
            <CreditCardType>Visa</CreditCardType>
            <CreditCardNumber>4711505238313977</CreditCardNumber>            
            <ExpMonth>03</ExpMonth>
            <ExpYear>2018</ExpYear>
            <CVV2>000</CVV2>            
          </CreditCard>
          <IPAddress>127.0.0.1</IPAddress>
          <MerchantSessionId>iou1mhmkuo1lnmd8e0vvpfbmp5</MerchantSessionId>
        </DoDirectPaymentRequestDetails>
      </DoDirectPaymentRequest>
    </DoDirectPaymentReq>
  </soap:Body>
</soap:Envelope>

从目标SandBox API端点(https://api.sandbox.paypal.com/2.0收到的响应)是:

<?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:ed="urn:ebay:apis:EnhancedDataTypes" xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:ns="urn:ebay:api:PayPalAPI">
        <SOAP-ENV:Header>
            <Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext" xsi:type="wsse:SecurityType"></Security>
            <RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" xsi:type="ebl:CustomSecurityHeaderType">
            <Credentials xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:UserIdPasswordType">
                <Username xsi:type="xs:string"></Username>
                <Password xsi:type="xs:string"></Password>
                <Signature xsi:type="xs:string"></Signature>
                <Subject xsi:type="xs:string"></Subject>
            </Credentials>
            </RequesterCredentials>
        </SOAP-ENV:Header>
        <SOAP-ENV:Body id="_0">
        <DoDirectPaymentResponse xmlns="urn:ebay:api:PayPalAPI">
            <Timestamp xmlns="urn:ebay:apis:eBLBaseComponents">2013-03-22T20:24:12Z</Timestamp>
            <Ack xmlns="urn:ebay:apis:eBLBaseComponents">Failure</Ack>
            <CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">94b4190427bbe</CorrelationID>
            <Errors xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:ErrorType">
                <ShortMessage xsi:type="xs:string">Invalid Data</ShortMessage>
                <LongMessage xsi:type="xs:string">The transaction cannot be processed due to an invalid address.</LongMessage>
                <ErrorCode xsi:type="xs:token">10540</ErrorCode>
                <SeverityCode xmlns="urn:ebay:apis:eBLBaseComponents">Error</SeverityCode>
            </Errors>
            <Version xmlns="urn:ebay:apis:eBLBaseComponents">2.0</Version>
            <Build xmlns="urn:ebay:apis:eBLBaseComponents">5479129</Build>
            <Amount xsi:type="cc:BasicAmountType" currencyID="USD">13.96</Amount>
        </DoDirectPaymentResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

这个问题(Cannot process transaction using PayPal module)表明SandBox的一个问题是等待可以解决...但是我的帐户是在19日创建的,我仍然得到相同的基于拒绝的神秘地址。

我也搜索过(paypal direct payment error on sandbox)和(Paypal Website payment Pro DoDirect Payment Integration issue.This transaction cannot be processed due to an invalid merchant configuration),但没有找到任何用处。

任何帮助都将不胜感激。

1 个答案:

答案 0 :(得分:1)

请求错误输出,因为您没有在发货地址字段中传递名称。您需要在此处插入名称,然后请求应该适合您。我运行了一些测试,一旦插入名称,测试确实很好。我也使用的是版本98.0,它应该是最新版本。您目前将其设置为2.0。

<ShipToAddress>
<Name></Name>
<Street1>1313 Park Forest</Street1>
<Street2></Street2>
<CityName>Batavia</CityName> 
<StateOrProvince>OH</StateOrProvince>
<PostalCode>45103</PostalCode>
<Country>US</Country>
</ShipToAddress>