What is the ruling of buying one’s groceries using loaned money and only paying it back after receiving one’s salary?
Alhamdulillah, praise and gratitude to Allah SWT for His countless blessings for us all. Praise and salutations to our beloved Prophet Muhammad PBUH, his family, companions and all those who follow his footsteps until the Last Day.
Lexically, debt means any liability (loan/obligation/responsibility) in the future that is the responsibility of a person either in the form of money or others.
In al-Fiqh al-Manhaji, it is stated: According to jurists’ the terminology debt is handing over ownership of something to another on the condition that the person returns it back without any additions. 
Indeed, Islam emphasizes the concept of giving loan through Allah SWT’s statement:
يَا أَيُّهَا الَّذِينَ آمَنُوا إِذَا تَدَايَنتُم بِدَيْنٍ إِلَىٰ أَجَلٍ مُّسَمًّى فَاكْتُبُوهُ ۚ
“O you who have believed, when you contract a debt for a specified term, write it down. And let a scribe write [it] between you in justice.” 
Ibn Kathir explained, “This verse is a guide from Allah SWT to His believing slaves so that they should write or record if they are doing trade with a delayed payment (debt).” 
The same is stated in a hadith from Ka’ab bin Malik RA:
أَنَّهُ تَقَاضَى ابْنَ أَبِى حَدْرَدٍ دَيْنًا كَانَ لَهُ عَلَيْهِ فِى الْمَسْجِدِ، فَارْتَفَعَتْ أَصْوَاتُهُمَا حَتَّى سَمِعَهَا رَسُولُ اللَّهِ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ وَهُوَ فِى بَيْتِهِ، فَخَرَجَ إِلَيْهِمَا حَتَّى كَشَفَ سِجْفَ حُجْرَتِهِ فَنَادَى: يَا كَعْبُ. قَالَ لَبَّيْكَ يَا رَسُولَ اللَّهِ. قَالَ: ضَعْ مِنْ دَيْنِكَ هَذَا. وَأَوْمَأَ إِلَيْهِ أَىِ الشَّطْرَ قَالَ لَقَدْ فَعَلْتُ يَا رَسُولَ اللَّهِ. قَالَ: قُمْ فَاقْضِهِ
“In the mosque l asked Ibn Abi Hadrad to pay the debts which he owed to me and our voices grew louder. Allah’s Messenger (ﷺ) heard that while he was in his house. So, he came to us raising the curtain of his room and said, “O Ka`b!” I replied, “Labaik, O Allah’s Messenger (ﷺ)!” He said, “O Ka`b! reduce your debt to one half,” gesturing with his hand. I said, “O Allah’s Messenger (ﷺ)! I have done so.” Then Allah’s Apostle said (to Ibn Abi Hadrad), “Get up and pay the debt to him.” 
According to the above question, hence the ruling of going into debt is permissible by syara’, however, there are rulings related to it. Hence, we’d like to take this opportunity to advise the following matters:
- The debt’s total should be written and recorded as sanctioned in the evidence of the sanctioning of debt. Jumhur of scholars the commandment of writing the debt is sunnah and not obligatory. It came together in uslub al-Irsyad which is a guideline and not something that is made obligatory. Writing down one’s debt is to prevent one from forgetting or having some doubts in the future.
- There is a witness when the debt transaction is happening. This is also in line with the statement of Allah SWT:
وَٱسۡتَشۡهِدُواْ شَهِيدَيۡنِ مِن رِّجَالِكُمۡۖ فَإِن لَّمۡ يَكُونَا رَجُلَيۡنِ فَرَجُلٌ وَٱمۡرَأَتَانِ مِمَّن تَرۡضَوۡنَ مِنَ ٱلشُّهَدَآءِ أَن تَضِلَّ إِحۡدَىٰهُمَا فَتُذَكِّرَ إِحۡدَىٰهُمَا ٱلۡأُخۡرَىٰۚ
“And bring to witness two witnesses from among your men. And if there are not two men [available], then a man and two women from those whom you accept as witnesses – so that if one of the women errs, then the other can remind her.” 
Likewise, in taking a witness for debt cases, the sahih according to scholars is that it is sunnah. The witness detailed here is two men and if there is only one man then the place of the other man can be replaced with two women.
- Originally, every debt is obligatory to be paid back. However, if the creditor willingly let it go, then the debt ceases and the debtor is no longer bound to the debt.
To close, we state that for situations mentioned in the question, it is permissible to take out a loan in order to buy groceries and then the value of the debt is paid back after one receives his salary. In this issue, it is also subject to the discretion of the creditor.
May Allah SWT grant us all understanding in this religion. Amin.
 See al-Fiqh al-Manhaji, 4/121
 Surah al-Baqarah: 282
 See Tafsir Ibn Kathir, 1/411
 Narrated by al-Bukhari (2418) and Muslim (1558)
 Surah al-Baqarah: 282