Hi,
Normally, when you send the data of the order to the payment gateway to get the redirect URL to the payment form page, or when you actually do the redirection to the payment form page of the payment gateway, you have a parameter where you can specify the "return URL" for the customer when the payment is successful.
There, you want to provide the "after_end" URL of HikaShop. That will automatically clear the cart of the customer when he gets back to your website.
The after_end URL can be generated like that:
$return_url = HIKASHOP_LIVE."index.php?option=com_hikashop&ctrl=checkout&task=after_end";
Alternatively, if you really what to clear the cart in the onPaymentNotification function, you can directly delete the cart from the hikashop_cart and hikashop_cart_product tables in the database based on the user_id of the user linked to the order. However, if the customer has multiple carts (possible with the "Enable multi carts" setting activated), the customer could have several carts. So you won't be 100% sure that you're deleting the cart corresponding to the order unless you check the products of the cart against the products in the order.