i currently use the Transaction Search API from Paypal to get a list of transactions, however i have issues getting updated transaction_status, for example:
client pays transaction_status = S explained here , then the client later decides to refund the payment through his paypal account, now the transaction_status should be set to Status code "V", but the same transaction appears under "S" => success, ive waited for 1 hour but updates still dont take place, some say for new transactions there can be 3h or 24h delay.
but is there any fix to transaction update ? does paypal have a API Request that i can call to update the given transaction within the 31 day limit , i dont want to wait for 24 hours or more for my transactions to be updated?
example parameters that i use but should not show any refunded transaction
$params = [
'start_date' => $endDate->format('Y-m-dTH:i:sP'),
'end_date' => $currentDateTime->format('Y-m-dTH:i:sP'),
'transaction_type' => 'T0006',
'page_size' => 500,
'page' => $page,
'transaction_status' => 'S',
'instrument_type' => 'Sofort'
];
but in the response i get transaction_id with refunded status in which their ‘transaction_status’ is still ‘S’, but when i look at the transaction in paypal account, it has been refunded.
Thansk alot.
2
Answers
The Solution might not be the best one i have found, let me know if there is a better way into seeing if a transaction is refunded.
we can get the Transaction informations using the Transaction API and here we can use the
transaction_id
to call another API in which we can see the Status of the payment.{{base_url}}/v1/reporting/transactions?
and the API is called (Payments, Show captured payment details)
{{base_url}}/v2/payments/captures/:capture_id
then the API will return "status": "COMPLETED", or "status": "REFUNDED".
the only downside is that you will have to go through each transaction with a loop which i dont like and can cause delay in your work if there are alot of transactions that you have to check.
Edit: paypal also has Webhooks, this is the best solution for realtime changes to payments.
reversed != refunded
refunds are a separate transaction. the status will not be updated, it is accurate as-is