Action
rpress_insert_payment
On this page
Fires after a new payment has been created and saved, before its order status is set to pending.
Runs at the end of rpress_insert_payment(), once the RPRESS_Payment record has been saved with its items, customer, totals and meta. The order status is set to 'pending' immediately after the hook. RestroPress itself uses it to schedule auto-accept of the order. The $payment_data array may contain 'agree_to_terms_time' and 'agree_to_privacy_time' when the matching checkout checkboxes were ticked.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$payment_id | int | The ID of the newly created payment. |
$payment_data | array | The payment data array passed to rpress_insert_payment(), including 'user_info', 'cart_details', 'purchase_key' and 'price'. |
Example#
add_action( 'rpress_insert_payment', 'my_note_new_payment', 10, 2 );
function my_note_new_payment( $payment_id, $payment_data ) {
if ( ! empty( $payment_data['user_info']['email'] ) ) {
rpress_insert_payment_note( $payment_id, sprintf( 'Order created for %s', $payment_data['user_info']['email'] ) );
}
}
Notes#
Fires before the pending order status is applied, so the order status meta may not be set yet.
Source#
Fired from:
includes/payments/functions.php(line 217), inrpress_insert_payment()
See also#
rpress_order_auto_accept_scheduledrpress_insert_payment_note
Was this page helpful?
