بسم الله الرحمن الرحيم
If the saman (price) and mabi (goods) both are on credit then it is unlawful. The holy Prophet Muhammad (صلى الله عليه وسلم) has forbidden sale of credit with credit.
نهى رسول الله صلى الله عليه وسلم عن بيع الكالى بالكالى (الحديث)
Also the method which you have mentioned it is not bai (transaction), rather it appears to be gambling which is haram.
Allah knows Best!
Darul Uloom Deoband