Skip to content
Docs
Get RestroPress

Action

rpress_after_payment_actions

Updated
On this page

Fires after a payment has been completed, once the delayed or immediate after-payment processing runs.

By default it fires from a single WP-Cron event scheduled after rpress_complete_purchase, passing only the payment ID. If rpress_use_after_payment_actions returns false, it fires immediately from rpress_complete_purchase with the payment and customer objects as well. Use it for work that should not slow down the checkout request.

Available since RestroPress 1.0.0.

Parameters#

ParameterTypeDescription
$payment_idintPayment ID.
$paymentRPRESS_PaymentPayment object. Only passed when the actions run immediately.
$customerRPRESS_CustomerCustomer object. Only passed when the actions run immediately.

Example#

function my_after_payment( $payment_id, $payment = null, $customer = null ) {
	if ( ! $payment ) {
		$payment = new RPRESS_Payment( $payment_id );
	}
	$payment->add_note( 'Post-order processing finished' );
}
add_action( 'rpress_after_payment_actions', 'my_after_payment', 10, 3 );

Notes#

The cron path passes one argument and the immediate path passes three, so declare the second and third parameters as optional. The cron path runs only once per payment unless forced, tracked by the _rpress_complete_actions_run meta.

Source#

Fired from:

  • includes/payments/actions.php (line 143), in rpress_complete_purchase()
  • includes/payments/actions.php (line 186), in rpress_process_after_payment_actions()

See also#

Was this page helpful?