WC_Gateway_Paypal_IPN_Handler::validate_currency
Check currency from IPN matches the order.
Method of the class: WC_Gateway_Paypal_IPN_Handler{}
No Hooks.
Returns
null. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->validate_currency( $order, $currency );
- $order(WC_Order) (required)
- Order object.
- $currency(string) (required)
- Currency code.
WC_Gateway_Paypal_IPN_Handler::validate_currency() WC Gateway Paypal IPN Handler::validate currency code WC 10.7.0
protected function validate_currency( $order, $currency ) {
if ( $order->get_currency() !== $currency ) {
WC_Gateway_Paypal::log( 'Payment error: Currencies do not match (sent "' . $order->get_currency() . '" | returned "' . $currency . '")' );
/* translators: %s: currency code. */
$order->update_status( OrderStatus::ON_HOLD, sprintf( __( 'Validation error: PayPal currencies do not match (code %s).', 'woocommerce' ), $currency ) );
exit;
}
}