WC_Gateway_Paypal_IPN_Handler::validate_amount( WC_Order $order, int $amount )

Check payment amount from IPN matches the order.


Description Description


Parameters Parameters

$order

(Required) Order object.

$amount

(Required) Amount to validate.


Top ↑

Source Source

File: includes/gateways/paypal/includes/class-wc-gateway-paypal-ipn-handler.php

	protected function validate_amount( $order, $amount ) {
		if ( number_format( $order->get_total(), 2, '.', '' ) !== number_format( $amount, 2, '.', '' ) ) {
			WC_Gateway_Paypal::log( 'Payment error: Amounts do not match (gross ' . $amount . ')' );

			/* translators: %s: Amount. */
			$order->update_status( 'on-hold', sprintf( __( 'Validation error: PayPal amounts do not match (gross %s).', 'woocommerce' ), $amount ) );
			exit;
		}
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.