Skip to content
Docs
Get RestroPress

Action

rpress_before_resume_payment

Updated
On this page

Fires before checkout rewrites a pending payment that it is resuming.

Runs in rpress_insert_payment() after core has taken an exclusive claim on the session's pending payment, re-read it and confirmed it can be resumed. Core then replaces its fees, items and checkout details with the new data. Use it to capture or clear gateway data tied to the old version of the order. While core holds the claim, rpress_claim_payment() calls by other owners are refused.

Available since RestroPress 3.5.1.

Parameters#

ParameterTypeDescription
$payment_idintPayment about to be rewritten.
$payment_dataarrayData it will be rewritten with.
$paymentRPRESS_PaymentThe payment as re-read from the database.

Example#

add_action( 'rpress_before_resume_payment', 'my_before_resume_payment', 10, 3 );
function my_before_resume_payment( $payment_id, $payment_data, $payment ) {
	rpress_insert_payment_note( $payment_id, sprintf( __( 'Resuming checkout. Previous total: %s', 'my-plugin' ), $payment->total ) );
	delete_post_meta( $payment_id, '_my_gateway_intent_id' );
}

Source#

Fired from:

  • includes/payments/functions.php (line 169), in rpress_insert_payment()

See also#

Was this page helpful?