Skip to content
Docs
Get RestroPress

Filter

rpress_get_payment_transaction_id-{$gateway}

Updated
On this page

Filters the transaction ID of a payment when none has been stored, per gateway.

Applied in RPRESS_Payment::setup_transaction_id when the _rpress_payment_transaction_id meta is empty or equals the payment ID. The hook name ends with the payment's gateway key. A gateway can return the real transaction ID, for example one it keeps in its own meta. The default is the payment ID.

Parameters#

ParameterTypeDescription
$payment_idintID of the payment, used as the default transaction ID.

Return value#

string|int. The transaction ID.

Example#

function my_stripe_transaction_id( $payment_id ) {
	$id = get_post_meta( $payment_id, '_my_stripe_charge_id', true );
	return $id ? $id : $payment_id;
}
add_filter( 'rpress_get_payment_transaction_id-stripe', 'my_stripe_transaction_id' );

Source#

Applied in:

  • includes/payments/class-rpress-payment.php (line 1953), in RPRESS_Payment::setup_transaction_id()

See also#

Was this page helpful?