Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders\WooPayments

WooPaymentsRestController::get_woopay_eligibilityprotectedWC 1.0

Get WooPay eligibility status.

Method of the class: WooPaymentsRestController{}

No Hooks.

Returns

WP_REST_Response. The response.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_woopay_eligibility();

WooPaymentsRestController::get_woopay_eligibility() code WC 10.7.0

protected function get_woopay_eligibility() {
	// We use the Payments Settings stored business location to determine the eligibility.
	$location = $this->payments->get_country();

	$woopay_eligible_countries = array( 'US' );
	$is_eligible               = in_array( $location, $woopay_eligible_countries, true );

	return rest_ensure_response(
		array(
			'is_eligible' => $is_eligible,
		)
	);
}