Automattic\WooCommerce\Internal\Admin\Settings\PaymentProviders

AmazonPay::is_amazon_pay_in_sandbox_modeprivateWC 1.0

Check if the AmazonPay payment gateway is in sandbox mode.

For AmazonPay, there are two different environments: sandbox and production.

Method of the class: AmazonPay{}

No Hooks.

Returns

?true|false. True if the payment gateway is in sandbox mode, false otherwise. Null if the environment could not be determined.

Usage

// private - for code of main (parent) class only
$result = $this->is_amazon_pay_in_sandbox_mode(): ?bool;

AmazonPay::is_amazon_pay_in_sandbox_mode() code WC 9.9.3

private function is_amazon_pay_in_sandbox_mode(): ?bool {
	if ( class_exists( '\WC_Amazon_Payments_Advanced_API' ) &&
		is_callable( '\WC_Amazon_Payments_Advanced_API::get_settings' ) ) {

		$settings = \WC_Amazon_Payments_Advanced_API::get_settings();

		if ( isset( $settings['sandbox'] ) ) {
			return filter_var( $settings['sandbox'], FILTER_VALIDATE_BOOLEAN );
		}
	}

	// Let the caller know that we couldn't determine the environment.
	return null;
}