Skip to content
Docs
Get RestroPress

Action

rpress_complete_purchase

Updated
On this page

Fires when a payment is marked as complete.

Runs in rpress_complete_purchase after the payment's completed date has been saved. It fires once per payment, because the surrounding block only runs while the payment has no completed date. The customer object is the customer attached to the payment.

Available since RestroPress 1.0.0.

Parameters#

ParameterTypeDescription
$payment_idintPayment ID.
$paymentRPRESS_PaymentPayment object containing all payment data.
$customerRPRESS_CustomerCustomer object containing all customer data.

Example#

function my_on_purchase_complete( $payment_id, $payment, $customer ) {
	$payment->add_note( 'Completed for ' . $customer->email );
}
add_action( 'rpress_complete_purchase', 'my_on_purchase_complete', 10, 3 );

Notes#

The docblock in the source describes the 3-argument signature as added in 1.0.0. By default rpress_schedule_after_payment_action also runs on this hook to schedule the delayed rpress_after_payment_actions.

Source#

Fired from:

  • includes/payments/actions.php (line 128), in rpress_complete_purchase()

See also#

Was this page helpful?