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.

Метод класса: WC_Helper_Subscriptions_API{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$result = WC_Helper_Subscriptions_API::register_rest_routes();

Код WC_Helper_Subscriptions_API::register_rest_routes() WC 9.4.2

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',
				),
			),
		)
	);
}