rcp_get_user_payments()

Note: This is part of the developer docs and is considered custom code.
Unfortunately, we cannot provide support for custom code at this time as we do not have the additional resources that would be necessary to provide support for custom code. 

If you need assistance with this, please reach out to our list of consultants for further assistance:
https://codeable.io/developers/restrict-content-pro/
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’
}
}

Have more questions?

Submit a request