wp-pay/core

WordPress支付处理库的核心组件。

安装数: 107,510

依赖: 89

建议者: 0

安全性: 0

星标: 27

关注者: 5

分支: 3

类型:wordpress-plugin

v4.22.0 2024-09-09 14:27 UTC

README

WordPress Pay » Core

WordPress Pay » 核心

WordPress支付处理库旨在简化在WordPress中设置和维护支付以及与支付服务提供商的集成。它与像https://github.com/Payum/Payumhttps://github.com/thephpleague/omnipay这样的库相似,但更专注于WordPress。代码遵循WordPress编码标准,并使用了WordPress API。

目录

状态

Latest Stable Version Total Downloads Latest Unstable Version License Built with Grunt

命令行界面

检查挂起的支付状态

wp pay payment status $( wp post list --field=ID --post_type=pronamic_payment --post_status=payment_pending --order=ASC --orderby=date --posts_per_page=100 --paged=1 )

WordPress过滤器

pronamic_payment_gateway_configuration_id

\add_filter(
	'pronamic_payment_gateway_configuration_id',
	/**
	 * Filter the payment gateway configuration ID to use specific 
	 * gateways for certain WooCommerce billing countries.
	 *
	 * @param int     $configuration_id Gateway configuration ID.
	 * @param Payment $payment          The payment resource data.
	 * @return int Gateway configuration ID.
	 */
	function( $configuration_id, $payment ) {
		if ( 'woocommerce' !== $payment->get_source() ) {
			return $configuration_id;
		}

		$billing_address = $payment->get_billing_address();

		if ( null === $billing_address ) {
			return $configuration_id;
		}

		$id = $configuration_id;

		switch ( $billing_address->get_country_code() ) {
			case 'US':
				$id = \get_option( 'custom_us_gateway_configuration_id', $id );
				break;
			case 'AU':
				$id = \get_option( 'custom_au_gateway_configuration_id', $id );
				break;
		}

		if ( 'pronamic_gateway' === \get_post_type( $id ) && 'publish' === \get_post_status( $id ) ) {
			$configuration_id = $id;
		}

		return $configuration_id;
	},
	10,
	2
);

pronamic_gateway_configuration_display_value

\add_filter(
	'pronamic_gateway_configuration_display_value',
	function( $display_value, $post_id ) {
		return \get_post_meta( $post_id, '_pronamic_gateway_display_value', true );
	},
	10,
	2
);

pronamic_gateway_configuration_display_value_$id

\add_filter(
	'pronamic_gateway_configuration_display_value_payvision',
	function( $display_value, $post_id ) {
		return \get_post_meta( $post_id, '_pronamic_gateway_payvision_business_id', true );
	},
	10,
	2
);

Pronamic - Work with us