Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7000467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:40:30+00:00 2026-05-27T20:40:30+00:00

I work with an e-commerce website that uses a PayPal checkout component written in

  • 0

I work with an e-commerce website that uses a PayPal checkout component written in PHP. For accounting purposes I want to retrieve some additional information using the PayPal PHP SOAP API.

I found out how to access the transaction using the transaction id and the GetTransactionDetails object:

// snip - include PayPal libraries and set up APIProfile object -

$trans_details =& PayPal::getType('GetTransactionDetailsRequestType');
$tran_id = $_GET['transactionID'];
$trans_details->setTransactionId($tran_id, 'iso-8859-1');
$caller =& PayPal::getCallerServices($profile);
$response = $caller->GetTransactionDetails($trans_details);
$paymentTransDetails = $response->getPaymentTransactionDetails();

// snip - work with transaction details -

However, I need to enhance this so that I can find out the 12-character string transaction id first by using the invoice id which I have available in a local MySQL database (which is also referenced in the transaction on the PayPal website).

I guess that I have to use Transaction Search for that but I don’t know how to do this with the PHP SOAP API. How can I retrieve the transaction id for an invoice id?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:40:31+00:00Added an answer on May 27, 2026 at 8:40 pm

    I dived into the API documentation and managed to find it out.

    // snip - include PayPal libraries and set up APIProfile object (variable: profile) - 
    
    $trans_search =& PayPal::getType('TransactionSearchRequestType');
    
    // 01/12/201 as an example date, we always need a start date for the API
    $start_date_str = '01/12/2011'; 
    $start_time = strtotime($start_date_str);
    $iso_start = date('Y-m-d\T00:00:00\Z', $start_time);
    $trans_search->setStartDate($iso_start, 'iso-8859-1');
    
    $invoice_ID = '10942456';  // here we insert the invoice ID we know
    $trans_search->setInvoiceID($invoice_ID);
    
    $caller =& PayPal::getCallerServices($profile);
    
    $response = $caller->TransactionSearch($trans_search); // execute search
    
    $ptsr = $response->getPaymentTransactions();
    $nrecs = sizeof($ptsr);
    $ack = $response->getAck();
    
    if( ($ack != ACK_SUCCESS) 
        && ($ack != ACK_SUCCESS_WITH_WARNING) ) 
        exit; // jump out on error
    
    if($nrecs == 1){ // check whether we found only one transaction (as expected)
        $paymentTransaction = $ptsr[0];
        // we found our transaction ID
        $transID = $paymentTransaction->getTransactionID();  
    }else{
        // invoice ID not unique?! :-(
        exit('Found multiple transactions: '. print_r($ptsr, true)); // jump out        
    }
    
    // snip - work with transaction ID - 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working on integrating a PHP/MySQL-based e-commerce website I manage with the
I'm working on a e-commerce website in PHP and I would like to implement
I'm working on adding some analytics code into our e-commerce website. What I'm doing
work on SQL Server 2000. want to Automated Email Notifications using SQL Server Job
I work in VBA, and want to parse a string eg <PointN xsi:type='typens:PointN' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
At work, we have multiple branches that we may be working on at any
Background: I'm working on an e-commerce website. It was my original intention to add
I need advice. I inherited a website that's been around a long time. The
work on Sql server 2000. i want to get the current server date and
I'd like to set-up AdBrite on my Flex 3 website. AdBrite suggested that I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.