Automattic\WooCommerce\Blocks\Payments\Integrations

PayPal::get_payment_method_datapublicWC 1.0

Returns an array of key=>value pairs of data made available to the payment methods script.

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

Хуков нет.

Возвращает

Массив.

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

$PayPal = new PayPal();
$PayPal->get_payment_method_data();

Код PayPal::get_payment_method_data() WC 10.6.2

public function get_payment_method_data() {
	$gateway = WC_Gateway_Paypal::get_instance();

	if ( ! $gateway->is_available() ) {
		return [];
	}

	$buttons = new PayPalButtons( $gateway );
	$options = $buttons->get_options();

	return [
		'title'                  => $this->get_setting( 'title' ),
		'description'            => $this->get_description(),
		'supports'               => $this->get_supported_features(),
		'isButtonsEnabled'       => $buttons->is_enabled(),
		'isProductPage'          => is_product(),
		'appSwitchRequestOrigin' => $buttons->get_current_page_for_app_switch(),
		'buttonsOptions'         => $options,
		'wc_store_api_nonce'     => wp_create_nonce( 'wc_store_api' ),
		'create_order_nonce'     => wp_create_nonce( 'wc_gateway_paypal_standard_create_order' ),
		'cancel_payment_nonce'   => wp_create_nonce( 'wc_gateway_paypal_standard_cancel_payment' ),
	];
}