Skip to main content
Easy Digital Downloads Documentation
Documentation, Reference Materials, and Tutorials for Easy Digital Downloads

edd_get_payment_transaction_id()

The 
edd_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 = edd_get_payment_transaction_id( $payment_id );

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

  • $transaction_id
  • $payment_id

Transaction ID tracking was implemented in EDD v2.1 and 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 
edd_get_payment_transaction_id-{gateway name} filter is applied before the edd_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.

Read our latest blog post:
Add More Stripe Payment Methods at Checkout