Question

Trying to make PayPal Invoicing application. Classic API, no REST.

I was able to pass through Sandbox authentication issues and APP ID problems. And now I'm facing dead-end.

Getting error 520002 - Internal Error from PayPal

No error description or whatsoever I can find on it...

Paypal notifications shows no downtime :(

Here is the call details (just in case)

Endpoint:

https://svcs.sandbox.paypal.com/Invoice/CreateInvoice

cUrl headers (credentials replaced):

X-PAYPAL-SECURITY-USERID: --myuserid--_api1.hotmail.com
X-PAYPAL-SECURITY-PASSWORD: 1-------5
X-PAYPAL-SECURITY-SIGNATURE: ---------------------------------------------------
X-PAYPAL-SECURITY-SUBJECT: 
X-PAYPAL-SECURITY-VERSION: 98.0
X-PAYPAL-REQUEST-DATA-FORMAT: XML
X-PAYPAL-RESPONSE-DATA-FORMAT: XML
X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T
X-PAYPAL-DEVICE-ID: 
X-PAYPAL-DEVICE-IPADDRESS: --my-ip--
X-PAYPAL-SANDBOX-EMAIL-ADDRESS: 

response received

<?xml version='1.0' encoding='UTF-8'?>
<ns3:FaultMessage xmlns:ns3="http://svcs.paypal.com/types/common" xmlns:ns2="http://svcs.paypal.com/types/pt">
<responseEnvelope>
<timestamp>2014-02-12T09:53:18.054-08:00</timestamp>
<ack>Failure</ack>
<correlationId>e9c370e69f506</correlationId>
<build>9180443</build>
</responseEnvelope>
<error>
    <errorId>520002</errorId>
    <domain>PLATFORM</domain>
    <subdomain>Application</subdomain>
    <severity>Error</severity>
    <category>Application</category>
    <message>Internal Error</message>
</error>
</ns3:FaultMessage>

End the XML being posted:

<?xml version="1.0" encoding="utf-8"?>
<CreateInvoiceRequest xmlns="http://svcs.paypal.com/types/ap">
<requestEnvelope xmlns="">
    <detailLevel>ReturnAll</detailLevel>
    <errorLanguage>en_US</errorLanguage>
</requestEnvelope>
<invoice xmlns="">
    <merchantEmail xmlns="">[email]</merchantEmail>
    <payerEmail xmlns="">[payer-email]</payerEmail>
    <number xmlns="">218755-2014FebWed-140558</number>
    <merchantInfo xmlns="">
        <businessName xmlns="">businessName.com</businessName>
        <phone xmlns="">123-1231234</phone>
        <website xmlns="">http://www.businessName.com</website>
        <customValue xmlns="">Toll Free : 1-888-123-1231</customValue>
        <address xmlns="">
            <line1 xmlns="">6890 rue paypal</line1>
            <city xmlns="">PayPal city</city>
            <state xmlns="">QC</state>
            <postalCode xmlns="">H1H1H1</postalCode>
            <countryCode xmlns="">CA</countryCode>
        </address>
    </merchantInfo>
    <itemList xmlns="">
        <item xmlns="">
            <name xmlns="">GEN0071</name>
            <description xmlns="">Special order item (Dress)</description>
            <quantity xmlns="">1</quantity>
            <unitPrice xmlns="">10.00</unitPrice>
        </item>
    </itemList>
    <currencyCode xmlns="">CAD</currencyCode>
    <invoiceDate xmlns="">2014-02-12</invoiceDate>
    <dueDate xmlns="">2014-02-12</dueDate>
    <paymentTerms xmlns="">DueOnReceipt</paymentTerms>
    <discountAmount xmlns="">0.00</discountAmount>
    <billingInfo xmlns="">
        <firstName xmlns="">B</firstName>
        <lastName xmlns="">K</lastName>
        <businessName xmlns=""></businessName>
        <phone xmlns="">123-9867</phone>
        <address xmlns="">
            <line1 xmlns="">9203 rue buyer</line1>
            <city xmlns="">Buyer city</city>
            <state xmlns="">QC</state>
            <postalCode xmlns="">N2N2N2</postalCode>
            <countryCode xmlns="">CA</countryCode>
        </address>
    </billingInfo>
    <shippingInfo xmlns="">
        <firstName xmlns="">B</firstName>
        <lastName xmlns="">K</lastName>
        <businessName xmlns=""></businessName>
        <phone xmlns="">123-9867</phone>
        <address xmlns="">
            <line1 xmlns="">9203 rue buyer</line1>
            <city xmlns="">Buyer city</city>
            <state xmlns="">QC</state>
            <postalCode xmlns="">N2N2N2</postalCode>
            <countryCode xmlns="">CA</countryCode>
        </address>
    </shippingInfo>
    <shippingAmount xmlns="">0.00</shippingAmount>
    <logoUrl xmlns="">http://www.businessName.com/images/logo.png</logoUrl>
    <referrerCode xmlns="">PHPClass</referrerCode>
</invoice>
</CreateInvoiceRequest>
Was it helpful?

Solution

Here's a sample of a CreateAndSendInvoice request that returns a successful response.

<?xml version="1.0" encoding="utf-8"?>
<CreateAndSendInvoiceRequest xmlns="http://svcs.paypal.com/types/ap">
  <requestEnvelope xmlns="">
    <detailLevel>ReturnAll</detailLevel>
    <errorLanguage>en_US</errorLanguage>
  </requestEnvelope>
  <invoice xmlns="">
    <merchantEmail xmlns="">sandbo_1215254764_biz@angelleye.com</merchantEmail>
    <payerEmail xmlns="">payer@email.com</payerEmail>
    <number xmlns="">ABCZ-122345678</number>
    <merchantInfo xmlns="">
      <firstName xmlns="">Tester</firstName>
      <lastName xmlns="">Testerson</lastName>
      <businessName xmlns="">Testers, LLC</businessName>
      <phone xmlns="">555-555-5555</phone>
      <fax xmlns="">555-555-5556</fax>
      <website xmlns="">http://www.domain.com</website>
      <customValue xmlns="">Some custom info.</customValue>
    </merchantInfo>
    <itemList xmlns=""><item xmlns="">
      <name xmlns="">Test Widget 1</name>
      <description xmlns="">This is a test widget #1</description>
      <date xmlns="">2012-02-18</date>
      <quantity xmlns="">1</quantity>
      <unitPrice xmlns="">10.00</unitPrice>
      </item><item xmlns="">
      <name xmlns="">Test Widget 2</name>
      <description xmlns="">This is a test widget #2</description>
      <date xmlns="">2012-02-18</date>
      <quantity xmlns="">2</quantity>
      <unitPrice xmlns="">20.00</unitPrice>
      </item></itemList>
    <currencyCode xmlns="">USD</currencyCode>
    <paymentTerms xmlns="">DueOnReceipt</paymentTerms>
    <note xmlns="">This is a test invoice.</note>
    <merchantMemo xmlns="">This is a test invoice.</merchantMemo>
    <shippingAmount xmlns="">10.00</shippingAmount>
    <logoUrl xmlns="">https://www.usbswiper.com/images/angelley-clients/cpp-header-image.jpg</logoUrl>
    <referrerCode xmlns="">AngellEYE_PHPClass</referrerCode>
  </invoice>
</CreateAndSendInvoiceRequest>

I would compare yours to that and see if you find any glaring differences that may be causing your issue. For example, if you have XML elements in the wrong place that could result in an Internal Error from PayPal like you're seeing.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top