The invention relates to a method for generating a two-dimensional code and implementing mobile payment by a mobile phone. A user can input various payment card information (such as bank card account numbers, credit card account numbers, prepaid card account numbers, and third party payment user account numbers) into the mobile phone, the information is enciphered and stored, and then the two-dimensional code is generated and displayed on a screen of the mobile phone. A merchant scans a pattern of the two-dimensional code through a two-dimensional code identifying and reading device, and after user authentication information (such as two-dimensional code generation time, mobile phone fingerprints and mobile phone positions) and the payment card information are decoded, the user authentication information, the payment card information, consumption amount information of the user, merchant account number information and the like are enciphered and sent to a corresponding payment and settlement system. After receiving the information, a payment and settlement server confirms the payment card information to be true or false according to the two-dimensional code authentication information, and carries out payment transaction. The method has the main advantage that the user can save the information of various payment cards, consumption cards and the like in the mobile phone and realize no-card electronic payment transaction instead of the various payment cards.