Author: bibhu 327 views

The  rpress_get_payment_transaction_id() function is used to retrieve the transaction ID related to a specific purchase.

The function takes the payment ID as a parameter:

$trans_id = rpress_get_payment_transaction_id( $payment_id );

The transaction ID returned is passed through a filter called  rpress_get_payment_transaction_id, which receives two parameters:

  • $transaction_id
  • $payment_id

Transaction ID is done on a per-gateway basis, so not all payment records will have transaction IDs. If a transaction ID does not exist for a payment record, the  rpress_get_payment_transaction_id-{gateway name} filter is applied before the rpress_get_payment_transaction_id filter so that the transaction ID can (possibly) be pulled from the payment notes. This allows payment gateways to update old payment records over time by retrieving the transaction ID from a custom storage method unique to that gateway.