HSBC - PayerTxnId is not in a valid base64 encoding. 28 Nov 2012

Just upgraded a client's site to use the latest xml api from HSBC - all very smooth apart from an error in the 3D Secure callback page.

Started getting the "PayerTxnId 'Chwkeeblc4Tr2pLpA03bIY aoM4=' is not in a valid base64 encoding." error message.

Turns out the string being passed back contained a space in it and was breaking things. Changing the code to Dim XID As String = Request.Form("XID").Replace(" ", "+") fixed everything.