rcp_get_user_payments()

Returns an array of all payment objects for a given user.

Parameters:

  • $user_id - ID of the user to get payments for. If omitted, the ID of the currently logged in member is used.

Return values:

  • array of payment objects from the database.

Example usage:

$payments = rcp_get_user_payments();

if( $payments ) {
    foreach( $payments as $payment ) {
        printf( __( 'ID: %s', 'rcp' ), $payment->id ); // Payment ID number
        printf( __( 'Subscription: %s', 'rcp' ), $payment->subscription ); // Name of the associated subscription level
        printf( __( 'Date: %s', 'rcp' ), $payment->date ); // Date the payment was made, in MySQL format
        printf( __( 'Amount: %s', 'rcp' ), $payment->amount ); // Amount the payment was for
        printf( __( 'User ID: %s', 'rcp' ), $payment->user_id ); // ID of the associated user
        printf( __( 'Payment Type: %s', 'rcp' ), $payment->payment_type ); // How the payment was made
        printf( __( 'Subscription Key: %s', 'rcp' ), $payment->subscription_key ); // Subscription key
        printf( __( 'Transaction ID: %s', 'rcp' ), $payment->transaction_id ); // Transaction ID
        printf( __( 'Status: %s', 'rcp' ), $payment->status ); // Status of the payment - 'complete', 'refunded'
    }
}