WC_Helper_Subscriptions_API::register_rest_routes()public staticWC 1.0

Registers the REST routes for the Marketplace Subscriptions API. These endpoints are used by the Marketplace Subscriptions React UI.

Method of the class: WC_Helper_Subscriptions_API{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = WC_Helper_Subscriptions_API::register_rest_routes();

WC_Helper_Subscriptions_API::register_rest_routes() code WC 9.0.1

public static function register_rest_routes() {
	register_rest_route(
		'wc/v3',
		'/marketplace/refresh',
		array(
			'methods'             => 'POST',
			'callback'            => array( __CLASS__, 'refresh' ),
			'permission_callback' => array( __CLASS__, 'get_permission' ),
		)
	);
	register_rest_route(
		'wc/v3',
		'/marketplace/subscriptions',
		array(
			'methods'             => 'GET',
			'callback'            => array( __CLASS__, 'get_subscriptions' ),
			'permission_callback' => array( __CLASS__, 'get_permission' ),
		)
	);
	register_rest_route(
		'wc/v3',
		'/marketplace/subscriptions/connect',
		array(
			'methods'             => 'POST',
			'callback'            => array( __CLASS__, 'connect' ),
			'permission_callback' => array( __CLASS__, 'get_permission' ),
			'args'                => array(
				'product_key' => array(
					'required' => true,
					'type'     => 'string',
				),
			),
		)
	);
	register_rest_route(
		'wc/v3',
		'/marketplace/subscriptions/disconnect',
		array(
			'methods'             => 'POST',
			'callback'            => array( __CLASS__, 'disconnect' ),
			'permission_callback' => array( __CLASS__, 'get_permission' ),
			'args'                => array(
				'product_key' => array(
					'required' => true,
					'type'     => 'string',
				),
			),
		)
	);
	register_rest_route(
		'wc/v3',
		'/marketplace/subscriptions/activate',
		array(
			'methods'             => 'POST',
			'callback'            => array( __CLASS__, 'activate' ),
			'permission_callback' => array( __CLASS__, 'get_permission' ),
			'args'                => array(
				'product_key' => array(
					'required' => true,
					'type'     => 'string',
				),
			),
		)
	);

	register_rest_route(
		'wc/v3',
		'/marketplace/subscriptions/install-url',
		array(
			'methods'             => 'GET',
			'callback'            => array( __CLASS__, 'install_url' ),
			'permission_callback' => array( __CLASS__, 'get_permission' ),
			'args'                => array(
				'product_key' => array(
					'required' => true,
					'type'     => 'string',
				),
			),
		)
	);
}