Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:2:283

And if you are on a journey and cannot find a scribe, then a security deposit ˹should be˺ taken. And if one of you entrusts another, then let him who is entrusted discharge his trust ˹faithfully˺ and let him fear Allah, his Lord. And do not conceal testimony, for whoever conceals it - his heart is indeed sinful, and Allah is Knowing of what you do.  

And if you are upon a journey, travelling and you contract a debt, and you do not find a writer, then a pledge (ruhun or rihān, plural of rahn) in hand, as a guarantee for you. The Sunna clarifies the permissibility of making pledges in towns, where writers may be forthcoming; but the stipulation is made in the event of travel because in this case it is more important to have a guarantee; God’s reference to it being ‘in hand’ (maqbūda) is a condition for the pledge given to be valid, and to satisfy the pledgee or his representative. But if one of you, the creditor, trusts another, the debtor, over the debt and does not require a pledge, let him who is trusted, the debtor, deliver his trust, the debt; and let him fear God his Lord, when delivering it. And do not conceal the testimony, if you are summoned to give it; whoever conceals it, his heart is sinful: the heart is mentioned because it is the locus of the testimony, and because if it sins, there are other sinful consequences, and so the person will be punished as though he were a sinner; and God knows what you do, nothing of which can be hidden from Him.
القرآن:٢:٢٨٣

وَإِنْ كُنْتُمْ عَلَىٰ سَفَرٍ وَلَمْ تَجِدُوا كَاتِبًا فَرِهَانٌ مَقْبُوضَةٌ ۖ فَإِنْ أَمِنَ بَعْضُكُمْ بَعْضًا فَلْيُؤَدِّ الَّذِي اؤْتُمِنَ أَمَانَتَهُ وَلْيَتَّقِ اللَّهَ رَبَّهُ ۗ وَلَا تَكْتُمُوا الشَّهَادَةَ ۚ وَمَنْ يَكْتُمْهَا فَإِنَّهُ آثِمٌ قَلْبُهُ ۗ وَاللَّهُ بِمَا تَعْمَلُونَ عَلِيمٌ  

{وإن كنتم على سفر} أي مسافرين وتداينتم {ولم تجدوا كاتبا فَرِهاَنٌ} وفي قراءة فَرهُنٌ جمع رهن {مقبوضة} تستوثقون بها وبينت السنة جواز الرهن في الحضر ووجود الكاتب فالتقيد بما ذكر لأن التوثيق فيه أشد وأفاد قوله مقبوضة اشتراط القبض في الرهن والاكتفاء به من المرتهن ووكيله {فإن أمن بعضكم بعضا} أي الدائن المدين على حقه فلم يرتهن {فليؤد الذي أؤتمن} أي المدين {أمانته} دينه {وليتق الله ربَّه} في أدائه {ولا تكتموا الشهادة} إذا دُعيتم لإقامتها {ومن يكتمها فإنه آثم قلبه} خص بالذكر لأنه محل الشهادة ولأنه إذا أثم تبعه غيره فيعاقب عليه معاقبة الآثمين {والله بما تعلمون عليم} لا يخفَى عليه شيء منه.