If the payment page gets an invalid pageid parameter (it is not the id of a custom payment page record), it should simply ignore that parameter. Right now it causes an exception.
To reproduce, go here:
https://gwop.na9.visual.force.com/apex/payment?pageid=bogus