Can anyone confirm how I can change the character restrictions for the postcode field during checkout? I need to enable a “/” to be used.
It seems to work ok during checkout, but as soon as I try to transfer to the payment gateway (Protx/Sagepay) it states:
Status: 5055 : A Postcode field contains invalid characters. (INVALID)
Any help appreciated.
This is how SagePay works, you can't change it. There should be no other characters except Letters and Numbers, even spaces are trimmed by SagePay.
Thanks, in that case, is there an easy way of blocking characters at the checkout stage so the customer doesn't go all the way to the payment gateway only for it to be rejected?
checkout the sagepay_direct.php file in the payments folder.
look for the line with ;
$post = 'BillingPostCode=' . $order_info['b_zipcode']
replace that line with these two lines
$fixed_bpostcode = preg_replace(“/[^A-Za-z0-9\s\s+-]/”, “”, $order_info['b_zipcode']);
$post = 'BillingPostCode=' . $fixed_bpostcode;
It will strip out any characters other than letters and numbers from the postcode field which is posted to Sagepay.
**make sure to backup your php file before saving changes, in case you need to restore it…