Filter
rpress_payment_meta
On this page
Filters the _rpress_payment_meta array before it is saved.
Applied when a payment is inserted and again each time RPRESS_Payment::save rebuilds the meta. Use it to add or alter keys in the stored payment meta array. The second argument is a summary of the payment data that describes the current state.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$payment_meta | array | The payment meta to be stored. |
$payment_data | array | Summary of the payment: price, date, user_email, purchase_key, currency, fooditems, user_info, cart_details, status and fees. |
Return value#
array. The payment meta to store.
Example#
function my_payment_meta( $payment_meta, $payment_data ) {
$payment_meta['my_source'] = 'web';
return $payment_meta;
}
add_filter( 'rpress_payment_meta', 'my_payment_meta', 10, 2 );
Notes#
In insert_payment the filtered value is the payment's current meta property; in save it is the existing meta merged with the new values. The meta is only written when its serialized form changed.
Source#
Applied in:
includes/payments/class-rpress-payment.php(line 544), inRPRESS_Payment::insert_payment()includes/payments/class-rpress-payment.php(line 914), inRPRESS_Payment::save()
See also#
Was this page helpful?
