Can I store 16 digit card number and its 4-digit pin temporarily in Arduino Mega?

I have an RFID RC522 reader which reads 16-digit card number and a mini keyboard attached to Arduino Mega 2560 Rev3 which reads 4-digit Pin Number. Now I have attached a ESP-8266 Wi-Fi module in order to send that 16-digit card number and 4-digit pin to server for verification whether it is valid card user. So now I want to send both card number and pin to server at once to make less number of requests to server.

Now I want to ask that whether there’s enough memory in Arduino to store 20 digits temporarily and get a bool value from server whether it is a valid user or not.

I would say yes. Unless you seriously waste memory on other stuff that you did not mention; hint: post your code (and use code tags when doing so).

I totally understand what you said but I didn’t bought an Arduino yet just researching about it, to get Arduino that fits on my needs. The main reason to post this question is whether I have to attach external memory to it or not?

You can compile code for a board that you don't have.

Compiling a simple MFRC522 example (dumpinfo) for a Mega tells me that it uses 279 bytes of RAM leaving 7913 bytes. So those 4 (or 20 bytes) will easily fit.

Oh great. Thanks for the help.

what do you expect the Arduino to do in your setup?
Why not buy a maker friendly NodeMCU or Wemos D1 and programm the ESP8266 instead of an Arduino and connect the cardreader to the ESP. No need for an Arduino.

It is great idea @noiasca. But this is only one scenario of my setup. The other scenarios needs Arduino after getting verified from server. It connects different sensors and modules which also have to send there data to server through ESP8266. So for that Arduino MEGA is needed.

so connect the different sensors to the ESP. Two microcontrollers bring in more complexity than one microcontroller. And just in case it is not clear enough: The ESP is not just "a Wifi Module" - its a full microcontroller with a lot more capabilities than an Arduino Mega. Compare RAM, Flash, procesor speed. If you run out of pins, use I2C expanders. Its far easier to expand pins for the ESP than to get reliable communication between and Mega and a ESP

Thank You so much for the helpful answer and I will do search on this NodeMCU sounds great . May be only this microcontroller is enough for my setup.

NodeMCU or Wemos D1 are what I call "maker friendly" boards. These modules are based on ESP8266 12E which has already some more pins than the ESP8266 01 "wifi module".
The boards come with an USB interface and you can upload sketches as you are used very similar to an Arduino.

The NodeMCU comes in at least two variants, the V2 with the CP2102 is 100mil smaller than the V3.
Personally I prefer this smaller variant, but honestly, all 3 boards (NodeMCU V2, V3, or Wemos D1) will give you the same programming experience

Unencrypted...? Sounds like a security risk to me.

I'm not saying we should. But there's nothing wrong with highlighting a massive security risk if there is an obvious one. It's then up to the project manager to pick up on it. So as far as I'm concerned, we don't need to discuss it beyond this.