problem in synchronization of rfid reader and keypad with arduino

currently i am working on paper free billing system, in this project which i want is to check a rfid tag , if it matches with the existing tag no. (like in security system) then it will ask user to enter amount of money which is to be deducted through keypad.
problem is individually all codes are working properly but when i synchronized these codes then keypad is not working

#define RELAYPIN 13
#define WARNLEDPIN 12
#include "Keypad.h"
char tag[] ="19004B3BB1D81"; // Replace with your own Tag ID
char input[12];				// A variable to store the Tag ID being presented
int count = 0;				// A counter variable to navigate through the input[] character array
boolean flag = 0;

const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'#','0','*'}
};
byte rowPins[ROWS] = {8, 7, 6, 5}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {4, 3, 2}; //connect to the column pinouts of the keypad
 
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
 			// A variable to store the Tag match status
void setup()
{
	Serial.begin(9600);		// Initialise Serial Communication with the Serial Monitor
	pinMode(RELAYPIN,OUTPUT);	// RELAY OUTPUT
	pinMode(WARNLEDPIN,OUTPUT); //WRONG TAG INDICATOR
}
void loop()
{
  
	if(Serial.available())// Check if there is incoming data in the RFID Reader Serial Buffer.
	{
		count = 0; // Reset the counter to zero
		/* Keep reading Byte by Byte from the Buffer till the RFID Reader Buffer is	empty 
		   or till 12 Bytes (the ID size of our Tag) is read */
		while(Serial.available() && count < 12) 
		{
			input[count] = Serial.read(); // Read 1 Byte of data and store it in the input[] variable
			count++; // increment counter
			delay(5);
		}
		/* When the counter reaches 12 (the size of the ID) we stop and compare each value 
		    of the input[] to the corresponding stored value */
		if(count == 12) // 
		{
			count =0; // reset counter varibale to 0
			flag = 1;
			/* Iterate through each value and compare till either the 12 values are 
			   all matching or till the first mistmatch occurs */
			while(count<12 && flag !=0)  
			{
				if(input[count]==tag[count])
				flag = 1; // everytime the values match, we set the flag variable to 1
				else
				flag= 0; 
                               /* if the ID values don't match, set flag variable to 0 and 
                                  stop comparing by exiting the while loop */
				count++; // increment i
			}
		}
		if(flag == 1) // If flag variable is 1, then it means the tags match
		{
			Serial.println("Access Allowed!");
			digitalWrite(RELAYPIN,HIGH);
			delay (5000);
			digitalWrite (RELAYPIN,LOW);
                       Serial.println("you balance is 1000 rs");
                       Serial.println("enter amount that is to be deducted");
                       

                    char key = keypad.getKey();
 
if (key != NO_KEY){
Serial.println(key);   
                       
		}}
		else
		{
			Serial.println("Access Denied"); // Incorrect Tag Message
			digitalWrite(WARNLEDPIN,HIGH);
			delay(5000);
			digitalWrite(WARNLEDPIN,LOW);
		}
		/* Fill the input variable array with a fixed value 'F' to overwrite 
		all values getting it	empty for the next read cycle */
		for(count=0; count<12; count++) 
		{
			input[count]= 'F';
		}
		count = 0; // Reset counter variable
	}
}

please help me .
reply ASAP. THANKYOU.

reply ASAP

When is our homework due?

Look at your code. When do you read a key? The getKey() function is NOT a blocking function. It will only tell you, IF a key is BEING pressed, which key it is.

You need to completely isolate the keypad code from the RFID code OR write blocking code to collect the keypad entry.

thank you