Using the Payment Meta API

Restrict Content Pro version 2.6 introduced a metadata API for payment records. This allows developers to store metadata that is directly associated with particular payments.

This API works nearly identical to the standard  WordPress metadata API.

global $rcp_payments_db;

// Add metadata
$rcp_payments_db->add_meta( $level_id = 0, $key = '', $value = '', $unique = true );

// Update metadata
$rcp_payments_db->update_meta( $level_id = 0, $key = '', $value = '', $previous_value = '' );

// Retrieve metadata
$rcp_payments_db->get_meta( $level_id = 0, $key = '', $single = true );

// Delete metadata
$rcp_payments_db->delete_meta( $level_id = 0, $key = '', $value = '' );