It was checking to make sure that the payment method $method was the one selected by the user.  It doesn't have any use in this context since what follows is all in response to a request specifically from bitpay.com and there are checks to ensure this.