A method for operating an electronic device storing a plurality of virtual cards in a digital wallet, wherein at least one virtual card stored in the digital wallet is associated with reference identification data, characterized in that it comprises the following steps, performed by a processing unit of the device : receiving (a), from a terminal connected to the electronic device , identification data related to the terminal ; selecting (b) each virtual card suitable for an interaction between the electronic device and the terminal , among the plurality of virtual cards stored in the digital wallet, as a function of at least said identification data related to the terminal , the selecting step (b) comprising comparing (b1) the received identification data with said reference identification data, a virtual card being selected as suitable for said interaction if the reference identification data it is associated with matches the received identification data related to the terminal , wherein, if no virtual card stored in the digital wallet is associated with reference identification data matching said identification data related to the terminal , the selecting step (b) further comprises requesting (b3) the selection by a user, among said plurality of virtual cards stored in the digital wallet, of a virtual card for performing the interaction, performing (c) the interaction between the electronic device and the terminal using one of the selected virtual cards; and storing (d) the received identification data related to the terminal as reference identification data associated with the virtual card selected for performing the interaction, characterized in that the step of storing (d) the received identification data related to the terminal as reference identification data associated with the virtual card selected for performing the interaction is performed only if the interaction is correctly performed at the step of performing (c) the interaction. receiving (a), from a terminal connected to the electronic device , identification data related to the terminal ; selecting (b) each virtual card suitable for an interaction between the electronic device and the terminal , among the plurality of virtual cards stored in the digital wallet, as a function of at least said identification data related to the terminal , the selecting step (b) comprising comparing (b1) the received identification data with said reference identification data, a virtual card being selected as suitable for said interaction if the reference identification data it is associated with matches the received identification data related to the terminal , wherein, if no virtual card stored in the digital wallet is associated with reference identification data matching said identification data related to the terminal , the selecting step (b) further comprises requesting (b3) the selection by a user, among said plurality of virtual cards stored in the digital wallet, of a virtual card for performing the interaction, performing (c) the interaction between the electronic device and the terminal using one of the selected virtual cards; and storing (d) the received identification data related to the terminal as reference identification data associated with the virtual card selected for performing the interaction, characterized in that the step of storing (d) the received identification data related to the terminal as reference identification data associated with the virtual card selected for performing the interaction is performed only if the interaction is correctly performed at the step of performing (c) the interaction. <EOS>