php - Searching for Paypal records by paymentId at Paypal account -
i have site uses paypal rest api sdk , capture paymentid after transaction.
i capture return_url's $_server['query_string'] using php.
i hoping client able go paypal account , search records using these paymentid's. doesn't seem case. there transactionid not match paymentid.
any idea how either:
- search record in paypal account using paymentid (using paypal account interface record tools - not api programming)
- grab transactionid after transaction (the return url gives me paymentid, token, , payerid.)
i've realized need take paymentid , use sdk retrieve more detailed payment information.
$apicontext = $this->getapicontext();
$payment = new payment(); $payment = $payment->get( $paymentid, $apicontext ); $execution = new paymentexecution(); $execution->setpayerid( $_get['payerid'] ); // ### retrieve payment // retrieve payment object calling // static `get` method // on payment class passing valid // payment id // (see bootstrap.php more on `apicontext`) try { $payment->execute( $execution, $apicontext ); if ( $payment ) { $obj = json_decode( $payment ); //get stuff $paypal_payment_id = $obj->{'id'}; $status = $obj->{'state'}; //do } } catch ( exception $ex ) { // note: please not use resultprinter class in original code. sample //resultprinter::printerror("get payment", "payment", null, null, $ex); log_message( 'error', 'error=' . $ex ); //exit(1); }
Comments
Post a Comment