Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders
AmazonPay::is_amazon_pay_onboarded
Check if the AmazonPay payment gateway is onboarded.
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 onboarded, false otherwise. Null if we failed to determine the onboarding status.
Usage
// private - for code of main (parent) class only $result = $this->is_amazon_pay_onboarded( $payment_gateway ): ?bool;
- $payment_gateway(WC_Payment_Gateway) (required)
- The payment gateway object.
AmazonPay::is_amazon_pay_onboarded() AmazonPay::is amazon pay onboarded code WC 10.8.1
private function is_amazon_pay_onboarded( WC_Payment_Gateway $payment_gateway ): ?bool {
try {
if ( class_exists( '\WC_Amazon_Payments_Advanced_API' ) &&
is_callable( '\WC_Amazon_Payments_Advanced_API::validate_api_settings' ) ) {
return true === \WC_Amazon_Payments_Advanced_API::validate_api_settings();
}
} catch ( \Throwable $e ) {
// Do nothing but log so we can investigate.
SafeGlobalFunctionProxy::wc_get_logger()->debug(
'Failed to determine if gateway is onboarded: ' . $e->getMessage(),
array(
'gateway' => $payment_gateway->id,
'source' => 'settings-payments',
'exception' => $e,
)
);
}
// Let the caller know that we couldn't determine the onboarding status.
return null;
}