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:5:106

O you who have believed, testimony ˹should be taken˺ among you when death approaches one of you at the time of bequest - ˹that of˺ two just men from among you or two others from outside if you are traveling through the land and the disaster of death should strike you. Detain them after the prayer and let them both swear by Allah if you doubt ˹their testimony, saying˺, "We will not exchange our oath for a price, even if he should be a near relative, and we will not withhold the testimony of Allah. Indeed, we would then be of the sinful."  

O you who believe, let testimony between you, when death, that is, ˹one of˺ its causes, draws near to one of you, at the time of a bequest, be that of two men of justice among you (ithnāni dhawā ‘adlin minkum, ‘two men of justice among you’, is the predicate expressed with the sense of an imperative, in other words, ‘let ˹two men˺ bear witness … ˹etc.˺’; the genitive annexation of shahāda, ‘testimony’, and bayn, ‘between’, is meant to allow for a range ˹of alternatives˺; hīn, ‘at the time of’, is a substitute for idhā, ‘when’, or an adverbial qualifier of time for ˹the verb˺ hadara, ‘draws near’); or of two others from another folk, that is, ˹from˺ other than your own religious community, if you are travelling in the land and the affliction of death befalls you. Then you shall empanel them, you shall detain them (tahbisūnahumā, ‘you shall empanel them’, is an adjectival qualification of ākharān, ‘two others’) after the, mid-afternoon, prayer and, if you are in doubt, ˹if˺ you are uncertain about it ˹their testimony˺, they shall swear by God, both of them saying: ‘We will not sell it, ˹our testimony˺ in ˹swearing by˺ God, for any price, ˹for˺ any compensation that we might take in exchange for it from this world, neither by swearing by Him ˹falsely˺, nor by testifying falsely for the sake of that ˹price˺; even if he, the person before whom it is being sworn or the one for whose sake testimony is being given, be a near kinsman, a close relative of ours, nor will we hide testimony to God, which He has commanded us ˹to give˺, for then, if we were to hide it, we would surely be among the sinful’.
القرآن:٥:١٠٦

يَا أَيُّهَا الَّذِينَ آمَنُوا شَهَادَةُ بَيْنِكُمْ إِذَا حَضَرَ أَحَدَكُمُ الْمَوْتُ حِينَ الْوَصِيَّةِ اثْنَانِ ذَوَا عَدْلٍ مِنْكُمْ أَوْ آخَرَانِ مِنْ غَيْرِكُمْ إِنْ أَنْتُمْ ضَرَبْتُمْ فِي الْأَرْضِ فَأَصَابَتْكُمْ مُصِيبَةُ الْمَوْتِ ۚ تَحْبِسُونَهُمَا مِنْ بَعْدِ الصَّلَاةِ فَيُقْسِمَانِ بِاللَّهِ إِنِ ارْتَبْتُمْ لَا نَشْتَرِي بِهِ ثَمَنًا وَلَوْ كَانَ ذَا قُرْبَىٰ ۙ وَلَا نَكْتُمُ شَهَادَةَ اللَّهِ إِنَّا إِذًا لَمِنَ الْآثِمِينَ  

{يا أيها الذين آمنوا شهادة بينكم إذا حضر أحدكم الموتُ} أي أسبابه {حين الوصية اثنان ذوا عدل منكم} خبر بمعنى الأمر أي ليشهد وإضافة شهادة لبين على الإتساع وحين بدل من إذا أو ظرف لحضر {أو آخران من غيركم} أي غير ملتكم {إن أنتم ضربتم} سافرتم {في الأرض فأصابكم مصيبة الموت تحبسونهما} توقفونهما صفة آخران {من بعد الصلاة} أي صلاة العصر {فيقسمان} يحلفان {بالله إن أرتبتم} شككتم فيها ويقولان {لا نشتري به} بالله {ثمنا} عوضا نأخذه بدله من الدنيا بأن نحلف به أو نشهد كذبا لأجله {ولو كان} المقسم له أو المشهود لله {ذا قربى} قرابة منا {ولا نكتم شهادة الله} التي أمرنا بها {إنا إذا} إن كتمناها {لمن الآثمين}.