0
votes

I am attempting to integrate a PayPal module into our osCommerce based site - a plugin that uses the PayPal DoDirectPayment (SOAP) API to perform credit card authorizations/payments through PayPal. So far I have:

  • Installed the module and gotten it working
  • Set up a Merchant account in PayPal Sandbox that is PaymentsPro enabled
  • Created a buyer account in Sandbox with a credit card
  • Verified that the billing address on our site matches the address for the credit card stored in PayPal Sandbox for the buyer account

I am able to proceed all the way through the checkout process; however each time the transaction fails with the following error message.

Invalid Data (10540)
The transaction cannot be processed due to an invalid address.

I have used step debugging (via XDEBUG) to verify that the address information specified in the checkout form is passed into the cUrl request. Find below the SOAP request as it appears shortly before being sent:

note that potentially sensitive information has been changed; however I directly compared the address in PayPal Sandbox to the address on our site - they are identical and conform to the field specifications listed in the API doc found here. page 42 and up

<?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: [email protected]</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>[email protected]</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>

The response received back from the target SandBox API endpoint (https://api.sandbox.paypal.com/2.0) is:

<?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>

This issue(Cannot process transaction using PayPal module) suggests that it is a problem with SandBox that waiting can resolve...however my accounts were created on the 19th and I am still getting the same mysterious address based rejections.

I also scoured (paypal direct payment error on sandbox) and (Paypal Website payment Pro DoDirect Payment Integration issue.This transaction cannot be processed due to an invalid merchant configuration) but did not find anything of use.

Any help would be appreciated.

1
Can you provide the full API response that you are getting back so that I can look to see what is causing the issue.PP_MTS_Chad
No problem; I've added the response retrieved by the cUrl requestDogoferis

1 Answers

1
votes

The request is erroring out because you are not passing over a name in the ship to address field. You would need to insert a name here, and then the request should work for you. I ran a few tests, and once the name is inserted the tests do go through fine. I also was using version 98.0, which should be the latest version. Your currently setting it to 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>