WordPress at Your Fingertips
function is not described

WC_Gateway_Paypal_IPN_Handler::validate_amount() protected WC 1.0

Check payment amount from IPN matches the order.

{} It's a method of the class: WC_Gateway_Paypal_IPN_Handler{}

No Hooks.

Return

null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->validate_amount( $order, $amount );
$order(WC_Order) (required)
Order object.
$amount(int) (required)
Amount to validate.

Code of WC_Gateway_Paypal_IPN_Handler::validate_amount() WC 5.7.1

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;
	}
}