moDevsome
moDevsome

Reputation: 209

Paypal REST API with PHP SDK - How to get the transaction number?

I'm using the REST API Paypal ExpressCheckout with the PHP SDK, my script is able to process payment but I would like to get a essential information about the payment : the transaction number, usefull for tracking payment.

He's anybody no how to get the transaction number after a payment ?

I use the version 1.

I've tried to do this :

$payment = Payment::get($paymentId, $apiContext);
$payment->getTransactions()[0]->getRelatedResources()[0]->getSale()->getId();

The returned result does not match with the transaction number.

I've also tried to do this :

$payment->getTransactions()[0]->getInvoiceNumber();

That returns NULL.

I've tried many object and methods of the API without finding the solution.

Thankz by advance for your help,

Mickaël

Upvotes: 1

Views: 1006

Answers (1)

Preston PHX
Preston PHX

Reputation: 30379

With v1/payments, when you execute the payment there will be a transactions->sale->id

With v2/checkout/orders, when you capture an order there will be a payments->captures->id

Upvotes: 1

Related Questions