It is not permissible to accept money in return for acting as guarantor for someone
Question

Someone asked me to act as his guarantor when buying a car by instalments, but I refused. Then he said to me: I intend to give two thousand riyals to the one who acts as my guarantor. So I accepted the money from him and agreed to act as his guarantor, because I needed the money. Is this money halaal for me?
Praise be to Allah.It is not permissible to accept money in return for acting as guarantor for someone, because this payment turns the guarantee contract into a riba-based contract.
The reason for that is as follows:
The guarantor is obliged to pay the debt on behalf of the one who is guaranteed, if the latter fails to pay it off. If the guarantor pays off the debt, then it is a loan from him to the one for whom he acted as guarantor, who must pay him back, in addition to the payment that they agreed upon in return for guaranteeing him. In that case, it becomes a loan in which something extra is paid back, and this is the essence of riba.
Ibn Qudaamah said in al-Mughni (6/441):
If he says: Act as my guarantor and I will give you one thousand, that is not permissible, because the guarantor becomes liable for the debt, and if he pays it off, the one whom he guaranteed now owes that to him, so it becomes like a loan, and if he accepts compensation, it becomes a loan that brings a benefit, so it is not permissible. End quote.
Ibn Jareer at-Tabari said in Ikhtilaaf al-Fuqaha’ (p. 9): If one man acts as guarantor for another man regarding money owed to a third man in return for a fee to be paid by the one for whom he acts as guarantor, then acting as a guarantor on that basis is invalid. End quote.
It says in a statement of the Islamic Fiqh Council regarding the guarantor contract:
Firstly: the guarantor contract, regardless of type, must be either covered or not covered. If it is not covered, this means that the guarantor is liable for what the one whom he guarantees is liable, either now or in the future. This in fact is what is known in Islamic fiqh as damaan or kafaalah (guarantee or sponsorship).
If the guarantee contract is covered [meaning that the money to pay the debt is already there], then the relationship between the one who is asking for the guarantee and the one who is offering it is one of wakaalah (acting as a proxy), and acting as a proxy is valid with or without a fee, provided that the kafaalah (guarantee or sponsorship) relationship is worked out to the benefit of the one who is guaranteed.
Secondly: kafaalah is something that is done as an act of charity with the intention of helping a fellow Muslim and the fuqaha’ have determined that it is not permissible to receive any compensation for that kafaalah, because in the event that the guarantor ends up paying, the contract becomes like a loan that brings a benefit, and that is not allowed according to Islamic teachings.
Based on that, the following was decided:
Firstly: it is not permissible to receive payment for acting as a guarantor – in which two elements are usually paid attention to, namely the amount that is guaranteed and the duration of the guarantee – whether it is covered or not.
Secondly: it is permissible to charge a fee to cover the administration costs involved in issuing the guarantee contract of either type, provided that those fees are no more than the going rate. In the case of a guarantor contract for a complete or partial guarantee, it is permissible to take into consideration, when working out the expenses for issuing this guarantee contract, what may be required of efforts to offer that coverage." (Qaraaraat Majma‘ al-Fiqh al-Islami, p. 25).
Based on the above, it is not permissible for you to accept that money, and you must return it to its owner.
And Allah knows best.