Praise be to Allah.
If the matter is as you describe, this transaction is a kind of gambling and is a major sin, because Allaah says (interpretation of the meaning):
“O you who believe! Intoxicants (all kinds of alcoholic drinks), and gambling, and Al-Ansaab (animals that are slaughtered on stone altars for idols), and Al-Azlaam (arrows for seeking luck or decision) are an abomination of Shaytaan’s (Satan’s) handiwork. So avoid (strictly all) that (abomination) in order that you may be successful.Shaytaan (Satan) wants only to excite enmity and hatred between you with intoxicants (alcoholic drinks) and gambling, and hinder you from the remembrance of Allaah and from As-Salaah (the prayer). So, will you not then abstain?”
The person who deals in these things must repent to Allaah, seek His forgiveness and avoid dealing in these things; he must get rid of any money that he has earned in this manner, so that Allaah will accept his repentance.
And Allaah is the source of strength. May Allaah bless our Prophet Muhammad and his family and companions, and grant them peace.