Add customer to an RCP subscription level when they purchase a specific product.
<?php
/*
 * Plugin Name: Easy Digital Downloads - Add User to RCP Subscription on Purchase
 * Description: Add customer to an RCP subscription level when they purchase a specific product.
 * Author: Easy Digital Downloads
 * Author URI: https://easydigitaldownloads.com/
 * Version: 1.0
 */

function pw_edd_add_customer_to_level( $payment_id = 0 ) {
	$user_id = edd_get_payment_user_id( $payment_id );
	if( $user_id <= 0 ) {
		return;
	}

	$downloads = edd_get_payment_meta_downloads( $payment_id );
	if( $downloads ) {

		$level = false;

		foreach( $downloads as $download ) {

			// Set the subscription level based on the product ID(s) purchased
			switch( $download['id'] ) {

				case 45:

					// Set the subscription level to add the user to
					$level = 4;

					break;

				case 742:

					break;

			}

		}

		if( ! empty( $level ) && function_exists( 'rcp_set_status' ) ) {

			// Give user one month of access
			$expiration = date( 'Y-m-d H:i:s', strtotime( '+1 month' ) );
			update_user_meta( $user_id, 'rcp_subscription_level', $level );
			update_user_meta( $user_id, 'rcp_expiration', $expiration );
			rcp_set_status( $user_id, 'active' );

		}

	}

}
add_action( 'edd_complete_purchase', 'pw_edd_add_customer_to_level' );
To implement this snippet on your site, create a brand new, empty WordPress plugin and paste the above code inside.