0

I must say, I can't remember the last time I've spent so much time figuring out an API. I loathe working with PayPal. That said...

I'm developing a seemingly simple script to download transactions into shipping software. I've got the script working to pull transactions in NVP and SOAP. But when a payment is on an invoice, the items purchased aren't included in the payment transaction info. So I'm assuming what I need is in the invoicing API.

I have API credentials that work just fine with TransactionSearch. I saw that for the Invoicing API, I also need an App Id, so I created an App, twice. Apparently there are two PayPal developer sites?? So I have a REST app created at developer.paypal.com and I guess a classic app "conditionally approved" at apps.paypal.com.

I guess after venting about the ridiculously unorganized developer structure and the sad excuse for documentation... !@#$ ... I'd like to find out if anyone can get me on the right track.

All I need to be able to do is see what invoices have come in (start-end date, etc) and get the details so it can be exported to our shipping software. Transactions work just fine, I'm not sure why invoices are so different or why there's so much more involved in getting that data?

Just as a reference, here's how we're pulling in our transactions:

$client = new SoapClient( 'https://www.paypal.com/wsdl/PayPalSvc.wsdl',
                       array( 
                        'location' => 'https://api-3t.paypal.com/2.0/',
                        'soap_version' => SOAP_1_1 
                        ));

$cred = array( 'Username' => $username,
           'Password' => $password,
           'Signature' => $signature
            );

$Credentials = new stdClass();
$Credentials->Credentials = new SoapVar( $cred, SOAP_ENC_OBJECT, 'Credentials' );

$headers = new SoapVar( $Credentials,
                    SOAP_ENC_OBJECT,
                    'CustomSecurityHeaderType',
                    'urn:ebay:apis:eBLBaseComponents' );

$client->__setSoapHeaders( new SoapHeader( 'urn:ebay:api:PayPalAPI',
                                       'RequesterCredentials',
                                       $headers ));

$args = array(
'Version' => '94.0',
'StartDate' => '2014-03-25T00:00:00Z'
);

$TransactionSearchRequest = new stdClass();
$TransactionSearchRequest->TransactionSearchRequest = new SoapVar(  $args, 
                                                                SOAP_ENC_OBJECT,
                                                                'TransactionSearchRequestType',
                                                                'urn:ebay:api:PayPalAPI');

$params = new SoapVar($TransactionSearchRequest, SOAP_ENC_OBJECT, 'TransactionSearchRequest');

$result = $client->TransactionSearch($params);

print_r($result);
kmcconnell
  • 331
  • 4
  • 14

1 Answers1

0

First, if you want to simplify your development with PayPal API's I'd recommend taking a look at my PHP class library for PayPal. It makes things much easier.

As for obtaining invoice details, you're correct that the Invoicing API is actually built on PayPal's Adaptive Payments platform which includes the App ID. I guess I'm a little confused on if you got that done or not..??

Once you have the APP ID, though, you can make the GetInvoiceDetails call to retrieve the invoice details.

Drew Angell
  • 25,968
  • 5
  • 32
  • 51
  • Thanks Andrew. I think I briefly saw that in my Google adventure and still couldn't figure out the credentials issue. I guess the biggest part I'm stuck on is figuring out exactly which credentials I need for this? I have the 3-part API signature in my merchant account, which works fine for transaction search, etc. I have a registered REST API app, which doesn't seem to have an App ID (just another 3-part sandbox and live signature set). Then I went to manage Classic API, and registered an app there, and got an App ID, but have no idea what signature set works with it lol. – kmcconnell Mar 25 '14 at 20:04
  • You'll use the username, password, and signature that you get from [this link](https://www.paypal.com/us/cgi-bin/webscr?cmd=_login-api-run). The sandbox version is [here](https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_login-api-run). You can also obtain those from your PayPal account profile under API Access. Then you'll use the App ID that you got for the Classic API. – Drew Angell Mar 26 '14 at 01:20