Problems encoding a message into base64

I'm trying my best to learn the basics of encryption. I think I've posted/read as much as I can about binary and hexadecimals and ASCII and I'm getting kind of frustrated. Could use some help:

I have a payload (a ruby hash) that looks like this:

payload = {
    39:       message: encrypted_message,
    40:       identifier: "some text",
    41:       iv: "some initialization value"
    42:     }
 => 43:     binding.pry
    44:     Base64.encode64(payload)

Here is the encrypted message:

encrypted_message
=> "@\xB1z\xBA\xAA\x97\xC9\e\xF3V\xCE\xE17\xF3\xE7E\xCBX\xAFr\x13\xB4`\x85\xD5\xC2~%\xEC[\xDF\x88"

It looks like the message is in hexadecimal format.

I'm trying to send the payload over http (an AJAX request to be specific) and so I'd like to Base64 encode it first (this is necessary right to make sure we use safe characters?).

However, when doing this, I get this error:

Base64.encode64(payload)
TypeError: no implicit conversion of Hash into String

So, now I think I need to convert it to a string:

payload.to_json
Encoding::UndefinedConversionError: "\xB1" from ASCII-8BIT to UTF-8

What am I doing wrong?