Offline payment method, system, device and storage medium
By generating an offline payment code using a secure element when the payment device is offline, the problem of users being unable to make payments in an environment without a network is solved, thus achieving secure offline payment.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- THE PEOPLES BANK OF CHINA DIGITAL CURRENCY INST
- Filing Date
- 2023-06-02
- Publication Date
- 2026-07-24
AI Technical Summary
In environments with poor or no network connectivity, existing payment code payment methods cannot be used, causing inconvenience for users and compromising security.
When the payment device is offline, the identity credential information and encrypted information are obtained through the secure element, a one-time password is generated using hash operation, and encrypted information is generated by combining the agreed key, wallet ID and transaction timestamp to generate offline payment code for the receiving device to verify and complete the digital currency transaction.
It enables secure generation of payment codes in an offline environment, ensuring payment security, preventing external malicious parsing attacks, and solving the problem of users being unable to make payments offline.
Smart Images

Figure CN119067650B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of mobile payment technology, and in particular to an offline payment method, system, device and storage medium. Background Technology
[0002] With the development of communication technology, payment code functionality has been widely used in daily life, bringing great convenience to people. When a user makes a payment using a payment terminal, the terminal needs to maintain a network connection with the server. The server can then generate a real-time payment code for the terminal upon receiving its request, ensuring high security.
[0003] However, the aforementioned offline payment methods are unavailable when users are in environments with poor network conditions or even no network access (such as subways or remote mountainous areas), causing inconvenience. Therefore, how to enable users to make payments using payment codes offline while ensuring payment security is a pressing technical problem that needs to be solved. Summary of the Invention
[0004] This application provides an offline payment method, system, device, and storage medium, aiming to enable users to make payments using payment codes offline while ensuring payment security. The technical solution of this application is as follows:
[0005] According to a first aspect of the embodiments of this application, an offline payment method is provided, applied to a payment device. The payment device includes a wallet, and the wallet includes a secure element. The secure element stores identity credential information and encrypted information. The encrypted information includes an agreed-upon key. The method includes: when the payment device is offline, responding to a user's payment request operation, obtaining the identity credential information and encrypted information from the secure element, and determining a transaction timestamp and a transaction time period based on the current timestamp; performing a hash operation on the transaction time period and the identity credential information to obtain a one-time password; generating ciphertext information based on the agreed-upon key, the one-time password, the wallet ID, and the transaction timestamp, and generating an offline payment code based on the ciphertext information; the offline payment code is used to display to a receiving device, so that the receiving device verifies the offline payment code through the wallet's server, and performs a digital currency transaction if the verification is successful.
[0006] In one possible implementation, the payment device is a payment terminal or a hardware wallet. When the payment device is a payment terminal, it has payment software installed. When the payment device is offline, in response to a user's payment request, it obtains identity credential information and encrypted information from the secure element, including: in response to a user's payment request via the payment software, it obtains the identity credential information and encrypted information from the secure element. When the payment device is a hardware wallet, it has a payment request button. When the payment device is offline, in response to a user's payment request, it obtains identity credential information and encrypted information from the secure element, including: in response to a user's payment request via the payment request button, it obtains the identity credential information and encrypted information from the secure element.
[0007] In one possible implementation, the identity credential information is the payment information corresponding to the ID of the wallet in the payment device; the method further includes: receiving payment information sent by the server when the payment device is connected to the network.
[0008] In one possible implementation, generating ciphertext information based on an agreed-upon key, a one-time password, a wallet ID, and a transaction timestamp includes: determining a process key based on the agreed-upon key and a temporary random number; and encrypting the one-time password, the wallet ID, and the transaction timestamp based on the process key to obtain the ciphertext information.
[0009] In one possible implementation, the method further includes: receiving identity credential information and encrypted information sent by the server when the payment terminal is connected to the network and successfully logged into the payment software; and storing the identity credential information and encrypted information in a secure element.
[0010] In one possible implementation, the method further includes: receiving identity credential information and encrypted information sent by the server when the hardware wallet is connected to the network and the user has activated the hardware wallet; and storing the identity credential information and encrypted information in a secure element.
[0011] In one possible implementation, the encrypted information includes a public key certificate, and the identity credential information is the server-encrypted identity credential information. When the payment terminal is connected to the network and successfully logged into the payment software, the system receives the identity credential information and encrypted information sent by the server of the payment software, and stores the identity credential information and encrypted information in a secure element. This includes: receiving the encrypted identity credential information and encrypted information sent by the server when the payment terminal is connected to the network and successfully logged into the payment software; verifying the signature of the public key certificate in the encrypted information; and, if the verification is successful, storing the encrypted identity credential information and encrypted information in a secure element.
[0012] In one possible implementation, the method further includes: when the payment device is offline, in response to a payment request operation of the user account, determining the current number of offline transactions of the user account; if the current number of offline transactions is greater than or equal to a preset threshold, generating a reminder message; the reminder message is used to remind the user to update their identity credential information via the internet.
[0013] In one possible implementation, after generating the notification message, the method further includes updating identity credential information and resetting the current offline transaction count when the hardware wallet switches from offline to online.
[0014] In one possible implementation, after generating the reminder information, the method further includes: updating the identity credential information and resetting the current number of offline transactions when the payment terminal switches from offline to online and successfully logs into the payment software again.
[0015] In one possible implementation, the secure element also stores the user's payment password; generating encrypted information based on the agreed key, one-time password, wallet ID, and current timestamp includes: generating encrypted information based on the agreed key, one-time password, wallet ID, current timestamp, and payment password when the current payment amount of the payment device is greater than the user's preset password-free payment amount.
[0016] According to a second aspect of the embodiments of this application, an offline payment method is provided, applied to a server, the server being used to provide payment services to payment devices including wallets; the method includes: when the payment device is offline, receiving an offline payment code of the payment device forwarded by a receiving device; the offline payment code is generated by the payment device based on an agreed key in encrypted information and identity credential information; verifying the offline payment code according to the agreed key, and if the verification is successful, agreeing to a digital currency transaction between the payment device and the receiving device.
[0017] In one possible implementation, upon successful verification, consent is granted for a digital currency transaction between the payment device and the receiving device, including: upon successful verification, transferring digital currency from the payment device's wallet to the receiving device's wallet.
[0018] In one possible implementation, the method further includes sending identity credential information and encrypted information to the payment device when the payment device is connected to the network.
[0019] In one possible implementation, the encrypted information includes a public key certificate; when the payment device is connected to the network, sending identity credential information and encrypted information to the payment device includes: encrypting the identity credential information when the payment device is connected to the network, and sending the encrypted identity credential information and encrypted information including the public key certificate to the payment device.
[0020] In one possible implementation, the offline payment code is generated by the payment device based on encrypted information. The encrypted information is generated by the payment device based on an agreed-upon key, a one-time password, a wallet ID, and a transaction timestamp. The one-time password is obtained by the payment device through a hash operation on the transaction time period and identity credential information. The offline payment code is verified according to the agreed-upon key, including: decrypting the offline payment code according to the agreed-upon key to obtain the one-time password and the wallet ID; determining the timestamps before and after the transaction timestamp to obtain multiple timestamps; generating a set of one-time passwords based on the time periods corresponding to the multiple timestamps and the wallet ID; comparing the one-time password with the one-time passwords in the set of one-time passwords, and if there is a one-time password in the set that is the same as the one-time password, the verification is successful.
[0021] In one possible implementation, a one-time password set is generated based on the time periods corresponding to multiple timestamps and the wallet ID, including: obtaining the wallet ID in the payment device, obtaining the corresponding identity credential information based on the wallet ID; and performing a hash operation on each time period and the identity credential information to obtain the one-time password set.
[0022] In one possible implementation, decrypting the offline payment code according to an agreed key to obtain a one-time password and a wallet ID includes: obtaining a temporary random number used by the payment device, and determining a process key based on the agreed key and the temporary random number; and decrypting the encrypted information in the offline payment code according to the process key to obtain a one-time password and a wallet ID.
[0023] According to a third aspect of the embodiments of this application, a payment system is provided, comprising a payment device, a receiving device, and a server; the payment device includes a wallet, the wallet including a secure element, the secure element storing identity credential information and encrypted information; the encrypted information includes an agreed-upon key; the payment device is configured to, in the event that the payment device is offline, respond to a user's payment request operation, obtain the identity credential information and encrypted information from the secure element, and determine a transaction timestamp and a transaction time period based on the current timestamp; the payment device is further configured to perform a hash operation on the transaction time period and the identity credential information to obtain a one-time password, and determine the one-time password based on the agreed-upon key. The system generates encrypted information using a one-time password, wallet ID, and transaction timestamp. An offline payment code is then generated based on this encrypted information. This offline payment code is displayed to the receiving device, allowing it to verify the code via the wallet's server. Upon successful verification, a cryptocurrency transaction is initiated. The receiving device acquires the offline payment code and sends it to the server. When the receiving device is offline, the server receives the offline payment code forwarded by the receiving device, verifies it using an agreed-upon key, and, upon successful verification, approves the cryptocurrency transaction between the receiving and receiving devices.
[0024] According to a fourth aspect of the embodiments of this application, a payment device is provided, applied to a payment device. The payment device includes a wallet, the wallet includes a security element, and the security element stores identity credential information and encrypted information; the encrypted information includes an agreed key; the device includes an acquisition unit, a processing unit, and a generation unit; the acquisition unit is used to, in response to a user's payment request operation when the payment device is offline, acquire the identity credential information and encrypted information in the security element, and determine the transaction timestamp and transaction time period based on the current timestamp; the processing unit is used to perform a hash operation on the transaction time period and identity credential information to obtain a one-time password; the generation unit is used to generate ciphertext information based on the agreed key, the one-time password, the wallet ID, and the transaction timestamp, and generate an offline payment code based on the ciphertext information; the offline payment code is used to display to a receiving device, so that the receiving device can verify the offline payment code through the wallet's server, and conduct a digital currency transaction if the verification is successful.
[0025] In one possible implementation, the payment device is a payment terminal or a hardware wallet; the acquisition unit is specifically used to: when the payment terminal is offline, in response to a payment request operation made by the user through the payment software, acquire the identity credential information and encryption information in the security element; when the payment device is a hardware wallet, the hardware wallet is provided with a payment request button, and the acquisition unit is specifically used to: when the hardware wallet is offline, in response to a payment request operation generated by the user through the payment request button, acquire the identity credential information and encryption information in the security element.
[0026] In one possible implementation, the identity credential information is the payment information corresponding to the ID of the wallet in the payment device; the acquisition unit is also used to: receive the payment information sent by the server when the payment device is connected to the network.
[0027] In one possible implementation, the generating unit is specifically used to: determine a process key based on an agreed key and a temporary random number; and encrypt a one-time password, a wallet ID, and a transaction timestamp based on the process key to obtain ciphertext information.
[0028] In one possible implementation, the acquisition unit is further configured to: receive identity credential information and encrypted information sent by the server when the payment terminal is connected to the network and successfully logs into the payment software; and store the identity credential information and encrypted information in a secure element.
[0029] In one possible implementation, the acquisition unit is further configured to: receive identity credential information and encrypted information sent by the server when the hardware wallet is connected to the network and the user has activated the hardware wallet; and store the identity credential information and encrypted information in a secure element.
[0030] In one possible implementation, the encrypted information includes a public key certificate, and the identity credential information is the server-encrypted identity credential information; the acquisition unit is specifically used to: receive the encrypted identity credential information and encrypted information sent by the server when the payment terminal is connected to the network and successfully logs into the payment software; perform signature verification on the public key certificate in the encrypted information, and if the verification is successful, store the encrypted identity credential information and encrypted information in the secure element.
[0031] In one possible implementation, the processing unit is further configured to: determine the current number of offline transactions of the user account in response to a payment request operation of the user account when the payment device is offline; generate a reminder message if the current number of offline transactions is greater than or equal to a preset threshold; the reminder message is used to remind the user to update their identity credential information via the network.
[0032] In one possible implementation, after generating the reminder information, the processing unit is further configured to: update the identity credential information and reset the current offline transaction count when the hardware wallet switches from offline to online.
[0033] In one possible implementation, after generating the reminder information, the processing unit is further configured to: update the identity credential information and reset the current number of offline transactions when the payment terminal switches from offline to online and successfully logs into the payment software again.
[0034] In one possible implementation, the secure element also stores the user's payment password; the generation unit is specifically used to: generate encrypted information based on the agreed key, one-time password, wallet ID, current timestamp, and payment password when the current payment amount of the payment device is greater than the user's preset passwordless payment amount.
[0035] According to a fifth aspect of the embodiments of this application, a payment device is provided, applied to a server, the server being used to provide payment services to payment devices including wallets; the device includes a receiving unit and a processing unit; the receiving unit is used to receive an offline payment code of the payment device forwarded by a receiving device when the payment device is offline; the offline payment code is generated by the payment device based on an agreed key in encrypted information and identity credential information; the processing unit is used to verify the offline payment code according to the agreed key, and if the verification is successful, agree to the payment device and the receiving device to conduct digital currency transactions.
[0036] In one possible implementation, the processing unit is specifically configured to: transfer digital currency from the wallet of the payment device to the wallet of the receiving device upon successful verification.
[0037] In one possible implementation, the payment device further includes a sending unit, which is used to send identity credential information and encrypted information to the payment device when the payment device is connected to the network.
[0038] In one possible implementation, the encrypted information includes a public key certificate; the sending unit is specifically used to: encrypt the identity credential information when the payment device is connected to the network, and send the encrypted identity credential information and the encrypted information including the public key certificate to the payment device.
[0039] In one possible implementation, the offline payment code is generated by the payment device based on encrypted information. The encrypted information is generated by the payment device based on an agreed-upon key, a one-time password, a wallet ID, and a transaction timestamp. The one-time password is obtained by the payment device through a hash operation on the transaction time period and identity credential information. The processing unit is specifically used to: decrypt the offline payment code according to the agreed-upon key to obtain the one-time password and the wallet ID; determine the timestamps before and after the transaction timestamp to obtain multiple timestamps; generate a set of one-time passwords based on the time periods corresponding to the multiple timestamps and the wallet ID; and compare the one-time password with the one-time passwords in the set of one-time passwords. If there is a one-time password in the set that is the same as the one-time password, the verification is successful.
[0040] In one possible implementation, the processing unit is specifically used to: obtain the ID of the wallet in the payment device, obtain the corresponding identity credential information based on the wallet ID; and perform hash operations on each time period and the identity credential information to obtain a set of one-time passwords.
[0041] In one possible implementation, the processing unit is specifically used to: obtain a temporary random number used by the payment device, and determine a process key based on the agreed key and the temporary random number; and decrypt the encrypted information in the offline payment code based on the process key to obtain a one-time password and a wallet ID.
[0042] According to a sixth aspect of the embodiments of this application, an electronic device is provided, the electronic device comprising: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute instructions to implement the offline payment method as described in the first or second aspect above.
[0043] According to a seventh aspect of the embodiments of this application, a computer-readable storage medium is provided, which enables an electronic device to perform the offline payment method as described in the first or second aspect above when computer execution instructions stored in the computer-readable storage medium are executed by a processor of an electronic device.
[0044] According to an eighth aspect of the embodiments of this application, a computer program product is provided, the computer program product including computer instructions, which, when executed on an electronic device, cause the electronic device to perform the offline payment method as described in the first or second aspect above.
[0045] The technical solution of the first aspect provided by the embodiments of this application brings at least the following beneficial effects: The offline payment method provided by this application can be applied to payment devices including wallets. The wallet includes a secure element storing identity credential information and encrypted information, the encrypted information including an agreed-upon key. Therefore, when the payment device is offline, in response to a user's payment request, the payment device can obtain the identity credential information and encrypted information from the secure element, and determine the transaction timestamp and transaction time period based on the current timestamp, providing support for offline payment. Furthermore, the payment device performs a hash operation on the transaction time period and identity credential information to obtain a one-time password, and generates encrypted information based on the agreed-upon key, the one-time password, the wallet ID, and the transaction timestamp to ensure the security of payments offline. In this way, the payment device can generate a payment code locally using the identity credentials and encrypted information stored in the secure element when offline, without relying on the server. This solves the problem that users cannot use payment codes to pay offline. Furthermore, since the identity credentials are stored in the secure element, it can prevent external malicious parsing attacks and protect data security. At the same time, the offline payment code generated by the payment device based on the encrypted information ensures that the server will only pay the payment device after successful verification, further guaranteeing the security of payments offline.
[0046] It should be noted that the technical effects of any of the implementation methods in aspects two through eight can be found in the technical effects of the corresponding implementation methods in aspect one, and will not be repeated here.
[0047] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0048] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application, and do not constitute an undue limitation of this application.
[0049] Figure 1 This is a schematic diagram illustrating the structure of a payment system according to an exemplary embodiment;
[0050] Figure 2 This is a flowchart illustrating a payment process in an offline scenario, according to an exemplary embodiment.
[0051] Figure 3 This is one of the flowcharts illustrating an offline payment method according to an exemplary embodiment;
[0052] Figure 4 This is a second flowchart illustrating an offline payment method according to an exemplary embodiment;
[0053] Figure 5 This is the third flowchart illustrating an offline payment method according to an exemplary embodiment;
[0054] Figure 6 This is the fourth flowchart illustrating an offline payment method according to an exemplary embodiment;
[0055] Figure 7 This is one of the structural schematic diagrams of a payment device according to an exemplary embodiment;
[0056] Figure 8 This is a second schematic diagram of the structure of a payment device according to an exemplary embodiment;
[0057] Figure 9 This is a schematic diagram of the structure of an electronic device according to an exemplary embodiment. Detailed Implementation
[0058] To enable those skilled in the art to better understand the technical solutions of this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.
[0059] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0060] Furthermore, in the description of the embodiments of this disclosure, unless otherwise stated, " / " means "or," for example, A / B can mean A or B. The term "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, in the description of the embodiments of this disclosure, "multiple" refers to two or more.
[0061] Furthermore, it should be noted that the user information involved in this application (including but not limited to payment information, user identity information, user bank card information, etc.) is all information authorized by the user or fully authorized by all parties.
[0062] Before providing a detailed explanation of the embodiments of this application, some relevant technical terms and technologies involved in the embodiments of this application will be introduced first.
[0063] Digital currency (DC) is an alternative form of electronic money. For example, the digital yuan is issued by the People's Bank of China, operated by designated institutions, and exchanged with the public. Based on a broad account system, it supports loosely coupled functions of bank accounts, is equivalent to paper money and coins, and is a controllable anonymous payment instrument with value characteristics and legal tender status.
[0064] A secure element (SE) is typically provided in the form of a chip. To prevent external malicious parsing attacks and protect data security, it contains encryption / decryption logic circuitry.
[0065] A smart card (Subscriber Identity Module, SIM) is an integrated circuit card (IC) held by mobile users of the Global System for Mobile Communications (GSM).
[0066] A QR code (Quick Response Code), also known as a two-dimensional barcode, is a type of encoding that can store more information and represent more data types than a traditional barcode.
[0067] Currently, QR code payments based on digital currency are increasingly used in various scenarios, but they all rely on the network. The process of generating a QR code requires that the payment terminal and the server maintain a network connection, i.e., an online QR code generation method. Specifically, when a user uses a payment terminal to make a payment, the payment terminal needs to maintain a network connection with the server. This allows the server to generate a real-time QR code for payment upon receiving a request from the payment terminal to obtain a payment code, resulting in a high level of security.
[0068] However, the above offline payment methods cannot be used when users are in environments with poor network conditions or even without network access (such as subways or remote mountainous areas), which causes inconvenience to users.
[0069] In view of the above-mentioned technical problems, this application provides an offline payment method that introduces offline QR code secure generation technology. Based on the SE chip, this method uses digital certificate authentication technology with domestic cryptographic algorithms and One-Time Password (OTP) technology to ensure the legitimacy of the visitor's identity, so as to prevent the key from being illegally stolen or tampered with, thereby improving the security of data transmission and making the offline generated QR code impossible to counterfeit. This method not only supports offline payment methods but also improves the security of offline payment methods.
[0070] The method provided in the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0071] Figure 1 An exemplary application scenario diagram provided by an embodiment of this application is shown. For example... Figure 1 As shown, the offline payment method provided in this application embodiment can be applied to payment system 10. Payment system 10 includes a payment device 11, a receiving device 12, and a server 13. The server 13 is connected to both the payment device 11 and the receiving device 12. The server 13 can be connected to the payment device 11 or the receiving device 12 via a wired connection or a wireless connection; this application embodiment does not limit the connection in this way.
[0072] The payment device 11 can be any payment terminal used by the user, such as a smartphone or smartwatch. The payment device 11 can also be a hardware wallet. Compared to a payment terminal, a hardware wallet has a relatively simple structure, typically containing only basic buttons (such as a payment request button), a display screen, and a communication module.
[0073] The payment device 11 includes a wallet (which consists of both hardware and software). For example, the hardware includes a security element, and the software includes payment software. The payment software can be any specific payment function software, such as a digital currency app. This application embodiment does not limit the specific payment software.
[0074] Optionally, the secure element can be embedded independently in the payment device 11 or in the SIM card of the payment device 11. The secure element stores identity credential information and encrypted information, including an agreed-upon key.
[0075] Payment device 11 is used to respond to user payment requests when the payment device is offline. It obtains identity credential information and encrypted information from the secure element, and performs a hash operation on the transaction time period and identity credential information to obtain a one-time password. Payment device 11 is also used to generate ciphertext information based on the agreed key, one-time password, wallet ID, and transaction timestamp, and generate an offline payment code based on the ciphertext information. The offline payment code is displayed to the receiving device, allowing the receiving device to verify the offline payment code through the wallet's server. If the verification is successful, a digital currency transaction is performed.
[0076] The payment device 12 can be any terminal device with payment function used by the merchant, such as a cash register.
[0077] The receiving device 12 is used to obtain the offline payment code generated by the payment device 11 and transmit the offline payment code to the server 13.
[0078] Server 13 can be a server with financial service functions, such as the bank server corresponding to the wallet on payment device 11.
[0079] Server 13 is used to receive the offline payment code forwarded by the receiving device from the payment device when the payment device is offline. Server 13 is also used to verify the offline payment code according to an agreed key, and if the verification is successful, to agree to the digital currency transaction between the payment device and the receiving device.
[0080] For example, such as Figure 2 As shown, in a scenario where a buyer pays using a smartphone while offline, after the merchant places an order using the POS terminal, the corresponding backend system generates a system order indicating the amount to be collected. The buyer generates an offline payment code via their smartphone and displays it to the merchant. The merchant then scans the buyer's offline payment code using the POS terminal's scanner, transmitting the code to the POS terminal's backend system. Further, the POS terminal's backend system sends the offline payment code to the bank server by calling a pre-defined payment interface. Upon receiving the offline payment code, the bank server verifies it. If verification is successful, the bank deducts the payment from the buyer's account and returns the deduction result to the POS terminal. After receiving the deduction result, the POS terminal prints a receipt for the buyer.
[0081] Figure 3 This is a flowchart illustrating an offline payment method according to some exemplary embodiments. In some embodiments, the above-described offline payment method can be applied to, for example... Figure 1 The payment system shown, such as the payment receiving device and the server, can also be applied to other similar devices.
[0082] like Figure 3As shown, the offline payment method provided in this application includes the following steps S201-S205.
[0083] S201. When the payment device is offline, the payment device responds to the user's payment request operation, obtains the identity credential information and encrypted information in the secure element, and determines the transaction timestamp and transaction time period based on the current timestamp.
[0084] As one possible implementation, when the payment device is a payment terminal, the payment terminal has payment software installed. When the payment terminal is offline, when a user needs to make a payment, the user submits a payment request through the payment software on the payment device. Accordingly, in response to the user's payment request through the payment software, the payment device obtains the identity credential information and encrypted information from the secure element and determines the current timestamp. Further, the payment device uses the current timestamp as the transaction timestamp and a preset time period following the current timestamp as the transaction time period.
[0085] It should be noted that the identity credential information and encrypted information are pre-stored in the secure element by the payment device to prevent malicious external analysis attacks. The payment device will only read the identity credential information and encrypted information from the secure element when it is offline and the user has a payment request. When the payment device is connected to the network, if the user needs to make a payment, the payment device can obtain a temporary payment code from the server via the network to make the payment to the receiving device.
[0086] The identity verification information can be the payment information corresponding to the wallet ID in the payment device. This payment information includes, but is not limited to, account information recorded on the UnionPay card, online payment account information for payment transactions based on the UnionPay card, identity authentication information, necessary personal information involved in the payment transaction, and other payment-related information. For example, payment information includes the user's mobile phone number, name, ID card number, bank card number, payment password, etc. This information can be received from the server when the payment device is connected to the internet.
[0087] As another possible implementation, when the payment device is a hardware wallet, the hardware wallet has a payment request button. When the hardware wallet is offline, the payment device responds to the user's payment request operation generated by the payment request button, and obtains the identity credential information and encrypted information from the secure element.
[0088] S202, The payment device performs a hash operation on the transaction time period and identity certificate information to obtain a one-time password.
[0089] As one possible implementation, the payment device uses a hash function to perform a hash operation on the transaction time period and identity credential information to obtain a hash value, also known as a one-time password (OTP).
[0090] S203. The payment device generates encrypted information based on the agreed key, one-time password, wallet ID, and transaction timestamp, and generates an offline payment code based on the encrypted information.
[0091] The offline payment code is displayed to the receiving device so that the receiving device can verify the offline payment code through the wallet's server and conduct digital currency transactions if the verification is successful.
[0092] As one possible implementation, the payment device determines a process key, also known as a session key, based on an agreed-upon key and a temporary random number. Further, the payment device encrypts the one-time password, wallet ID, and transaction timestamp using the process key to obtain ciphertext information. The payment device then converts the ciphertext information into a matrix QR code according to a preset encoding method and uses this matrix QR code as the offline payment code.
[0093] It should be noted that the process key is a randomly generated encryption and decryption key used to ensure secure communication between the payment device and the server. It can be negotiated between the payment device and the server. It is generally generated dynamically, only when session data encryption is required. The specific generation method can refer to any national cryptographic algorithm, such as SM3 or SM4. This application does not limit the specific encryption algorithm used.
[0094] In some embodiments, the payment device may also combine the OTP with other information (such as the model of the payment device) into a final matrix QR code as an offline payment code.
[0095] In some embodiments, to ensure the timeliness of the offline payment code, the payment device updates the offline payment code at specified intervals.
[0096] In practical applications, the agreed-upon key is pre-negotiated between the payment device and the server and stored in their respective devices. After the payment device obtains the process key based on the agreed-upon key and a temporary random number, it also informs the server of the temporary random number (e.g., by adding it to the offline payment code) so that the server can decrypt and use it.
[0097] S204. The server receives the offline payment code from the payment device forwarded by the receiving device.
[0098] As one possible implementation, when the payment device is offline, the receiving device scans the payment device's offline payment code and sends the scanned offline payment code to the server via the network. Correspondingly, the server receives the offline payment code forwarded by the receiving device.
[0099] It's important to note that while offline payment methods are possible for payment devices, the receiving device typically needs to be online to verify information with the server. The most crucial step in offline payment is the QR code scanning process. Through an online merchant, offline payment information is transmitted to the server for verification, enabling information exchange between offline and online channels. This allows the payment device to process payments even when offline.
[0100] S205. The server verifies the offline payment code according to the agreed key. If the verification is successful, the server agrees to the digital currency transaction between the payment device and the receiving device.
[0101] As one possible implementation, the server decrypts the offline payment code using an agreed-upon key to obtain a one-time password, the wallet ID, and the transaction timestamp. Further, the server verifies the one-time password. If verification is successful, the server approves the transaction between the payment device and the receiving device and provides payment services to the payment device. If verification fails, the server refuses the transaction between the payment device and the receiving device.
[0102] In some embodiments, to verify one-time passwords, the server can generate a set of one-time passwords based on various time periods corresponding to multiple timestamps and wallet IDs. Furthermore, the server compares the one-time password with the one-time passwords in the set; if a matching one-time password exists in the set, the verification is successful.
[0103] For example, after receiving the offline payment code, the server can obtain the temporary random number used by the payment device from the offline payment code, and determine the process key based on the agreed key and the temporary random number. The server then decrypts the encrypted information in the offline payment code using the process key, obtaining the one-time password, the wallet ID, and the transaction timestamp. Further, the server performs hash operations on the various time periods and identity credential information to obtain a set of one-time passwords. The server compares the decrypted one-time passwords with the one-time passwords in the set one by one; if any match is found, the verification is successful; otherwise, the transaction is rejected.
[0104] In some embodiments, the server provides payment services to the payment device after successful verification. Based on the bill sent by the receiving device, the server deducts the payment from the user account of the payment device. After successful deduction, the server pushes the notification to the payment software of the payment device in the form of a message notification or a user interface (UI).
[0105] For example, if the verification is successful, the server will transfer the digital currency from the payment device's wallet (also known as the payment wallet) to the receiving device's wallet.
[0106] It should be noted that a payment wallet can be a wallet with personal identification or a wallet without personal identification.
[0107] During the transaction process, such as Figure 4 As shown, after the payment receiving device generates an order, the user's account displays an offline payment code through the Digital Currency APP on the payment device. The payment receiving device obtains the offline payment code by scanning it and forwards it to the server by calling the order payment interface. Upon receiving the offline payment code, the server verifies it to determine whether it agrees to the transaction between the payment device and the payment receiving device, and returns the transaction result to both devices. If verification is successful, the server can indicate successful payment with code 0000 and display a payment success page on the Digital Currency APP of the payment device. Alternatively, the server can use code 1003 to indicate pending payment, code 2000 to indicate system error or network timeout, and code 1004 to indicate payment failure. Correspondingly, during the payment waiting period, the payment receiving device will repeatedly call the order query interface to obtain the order status until payment is successful or the polling time expires. If payment is still unsuccessful after the polling ends, the payment receiving device calls the order closing interface to end the current transaction. After receiving a payment failure message from the server, the payment device will check the payment parameters and call the payment interface again to obtain the transaction result from the server.
[0108] The embodiments provided in this application have the following beneficial effects: The offline payment method provided in this application can be applied to payment devices including wallets. The wallet includes a secure element that stores identity credential information and encrypted information, including a pre-agreed key. Therefore, when the payment device is offline, in response to a user's payment request, the payment device can obtain the identity credential information and encrypted information from the secure element, and determine the transaction timestamp and transaction time period based on the current timestamp, thus supporting offline payment. Furthermore, the payment device performs a hash operation on the transaction time period and identity credential information to obtain a one-time password, and generates encrypted information based on the pre-agreed key, one-time password, wallet ID, and transaction timestamp to ensure the security of payments offline. In this way, the payment device can generate a payment code locally using the identity credentials and encrypted information stored in the secure element when offline, without relying on the server. This solves the problem that users cannot use payment codes to pay offline. Furthermore, since the identity credentials are stored in the secure element, it can prevent external malicious parsing attacks and protect data security. At the same time, the offline payment code generated by the payment device based on the encrypted information ensures that the server will only pay the payment device after successful verification, further guaranteeing the security of payments offline.
[0109] In some embodiments, such as Figure 5 As shown, the server can verify the legitimacy of a user account by calling the certificate authorization and authentication center data interface of the Trusted Service Manager (TSM) platform to determine whether the user account has enabled the offline payment method function. Accordingly, the payment device applies for an offline QR code certificate from the TSM, and the TSM issues the offline QR code certificate to the payment device to enable the offline payment method function for the user account. Further, if the server determines that the user account has enabled the offline payment method function, it sends offline payment information to the payment device so that the payment device can use it when offline (including scanning by the receiving device and server verification). Additionally, when encrypting the payment information, the payment device can also apply for an OTP seed from the OTP server (i.e., the payment device sends the payment information to the OTP server to request encryption), and the OTP server returns the encryption result to the payment device (i.e., issues the OTP seed). Similarly, when decrypting the offline payment code, the server can also rely on the OTP server to obtain the verification result.
[0110] In a design, such as Figure 6 As shown, in order to support payment devices to make payments when offline, the offline payment method provided in this application embodiment further includes the following S301-S302:
[0111] S301. When the payment device is connected to the network, the server sends identity credential information and encrypted information to the payment device.
[0112] As one possible implementation, the encrypted information includes a public key certificate. When the payment device is connected to the internet, the server encrypts the identity credential information and sends the encrypted identity credential information, along with encrypted information including the public key certificate, to the payment device.
[0113] For example, the server can determine the process key based on the agreed key and the temporary random number, and encrypt the identity credential information based on the process key.
[0114] Optionally, the server can determine the identity credential information based on the wallet ID of the payment device.
[0115] Optionally, when a payment device logs into the digital RMB APP, the server can also obtain the user's account at the time of login and generate a corresponding unique token based on the user's account. This token contains the payment information of the user's account.
[0116] It should be noted that a public key certificate, often simply referred to as a certificate, is a digitally signed statement that binds the value of a public key to the identity of an individual, device, or service holding the corresponding private key.
[0117] S302. The payment device receives identity credential information and encrypted information, and stores the identity credential information and encrypted information in a secure element.
[0118] As one possible implementation, when the payment terminal is connected to the network and successfully logs into the payment software, the payment device receives identity credential information and encrypted information sent by the server, and stores the identity credential information and encrypted information in a secure element.
[0119] As another possible implementation, when the hardware wallet is connected to the network and the user has activated the hardware wallet, the payment device receives identity credentials and encrypted information sent by the server, and stores the identity credentials and encrypted information in a secure element.
[0120] For example, the encrypted information includes a public key certificate, and the identity credential information is the server-encrypted identity credential information. When the payment terminal is connected to the network and successfully logged into the payment software, the payment device receives the encrypted identity credential information and the encrypted information sent by the server. Further, the payment device verifies the public key certificate in the encrypted information by signing it. If the verification is successful, the payment device stores the encrypted identity credential information and the encrypted information in a secure element.
[0121] In one design, to ensure data security within the SE, the payment device and server set a limit on the number of offline transactions (e.g., a maximum of 12). When a certain number of offline transactions are reached, the payment software prompts the user to update the payment information by synchronizing the account online.
[0122] Optionally, when the payment device switches from offline to online and successfully logs into the payment software again, the payment information is updated and the current number of offline transactions is reset via the above steps S301-S302.
[0123] Optionally, for offline payment codes in the form of electronic cards, the payment information can be updated using a payment device via contactless or contact methods such as Bluetooth or Near Field Communication (NFC). Alternatively, when the internal design is about to reach the maximum number of offline transactions, the electronic card can update the payment information through its own internal program.
[0124] In some embodiments, when performing offline payments, the payment amount cannot exceed the user account's preset password-free payment limit. Normally, if the payment amount exceeds the password-free payment limit, the user account needs to enter a payment password on the payment software. However, the payment device cannot send the payment password to the server when offline. Therefore, when connected to the network, the payment device stores the user account's payment password in the SE (Secure Element). If the current payment amount exceeds the user account's preset password-free payment limit, the payment device retrieves the payment password from the secure element and generates an offline payment code based on the one-time password and the payment password for server verification.
[0125] The foregoing mainly describes the solutions provided by the embodiments of this application from a methodological perspective. To achieve the above functions, the payment device or electronic device includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0126] This application embodiment can, based on the above method, exemplarily divide a payment device or electronic device into functional modules. For example, the payment device or electronic device may include functional modules corresponding to each functional division, or two or more functions may be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division; in actual implementation, there may be other division methods.
[0127] For example, embodiments of this application also provide a payment device.
[0128] Figure 7 This is a block diagram illustrating a payment device according to an exemplary embodiment. (Refer to...) Figure 7 The payment device 40 includes an acquisition unit 401, a processing unit 402, and a generation unit 403.
[0129] The acquisition unit 401 is used to respond to the user's payment request operation when the payment device is offline, acquire the identity credential information and encrypted information in the secure element, and determine the transaction timestamp and transaction time period based on the current timestamp; the processing unit 402 is used to perform a hash operation on the transaction time period and identity credential information to obtain a one-time password; the generation unit 403 is used to generate ciphertext information based on the agreed key, one-time password, wallet ID, and transaction timestamp, and generate an offline payment code based on the ciphertext information; the offline payment code is used to display to the receiving device so that the receiving device can verify the offline payment code through the wallet's server, and conduct digital currency transactions if the verification is successful.
[0130] In one possible implementation, the payment device is a payment terminal or a hardware wallet; the acquisition unit 401 is specifically used to: when the payment terminal is offline, in response to a payment request operation made by the user through the payment software, acquire the identity credential information and encryption information in the security element; when the payment device is a hardware wallet, the hardware wallet is provided with a payment request button, and the acquisition unit 401 is specifically used to: when the hardware wallet is offline, in response to a payment request operation generated by the user through the payment request button, acquire the identity credential information and encryption information in the security element.
[0131] In one possible implementation, the identity credential information is the payment information corresponding to the ID of the wallet in the payment device; the acquisition unit 401 is also used to: receive the payment information sent by the server when the payment device is connected to the network.
[0132] In one possible implementation, the generation unit 403 is specifically used to: determine the process key based on the agreed key and the temporary random number; and encrypt the one-time password, the wallet ID, and the transaction timestamp based on the process key to obtain ciphertext information.
[0133] In one possible implementation, the acquisition unit 401 is further configured to: receive identity credential information and encrypted information sent by the server when the payment terminal is connected to the network and the payment terminal successfully logs into the payment software; and store the identity credential information and encrypted information in a secure element.
[0134] In one possible implementation, the acquisition unit 401 is further configured to: receive identity credential information and encrypted information sent by the server when the hardware wallet is connected to the network and the user has activated the hardware wallet; and store the identity credential information and encrypted information in a secure element.
[0135] In one possible implementation, the encrypted information includes a public key certificate, and the identity credential information is the server-encrypted identity credential information; the acquisition unit 401 is specifically used to: receive the encrypted identity credential information and encrypted information sent by the server when the payment terminal is connected to the network and the payment terminal successfully logs into the payment software; perform signature verification on the public key certificate in the encrypted information, and if the verification is successful, store the encrypted identity credential information and encrypted information in the secure element.
[0136] In one possible implementation, the processing unit 402 is further configured to: determine the current number of offline transactions of the user account in response to a payment request operation of the user account when the payment device is offline; generate a reminder message if the current number of offline transactions is greater than or equal to a preset threshold; the reminder message is used to remind the user to update their identity credential information via the network.
[0137] In one possible implementation, after generating the reminder information, the processing unit 402 is further configured to: update the identity credential information and reset the current offline transaction count when the hardware wallet switches from offline to online.
[0138] In one possible implementation, after generating the reminder information, the processing unit 402 is further configured to: update the identity credential information and reset the current number of offline transactions when the payment terminal switches from offline to online and successfully logs into the payment software again.
[0139] In one possible implementation, the security element also stores the user's payment password; the generation unit 403 is specifically used to generate encrypted information based on the agreed key, one-time password, wallet ID, current timestamp and payment password when the current payment amount of the payment device is greater than the user's preset password-free payment amount.
[0140] Figure 8 This is a block diagram of another payment device according to an exemplary embodiment. (Refer to...) Figure 8 The payment device 50 includes a receiving unit 501 and a processing unit 502.
[0141] The receiving unit 501 is used to receive the offline payment code of the payment device forwarded by the receiving device when the payment device is offline; the offline payment code is generated by the payment device based on the agreed key in the encrypted information and the identity certificate information; the processing unit 502 is used to verify the offline payment code according to the agreed key, and if the verification is successful, agree to the payment device and the receiving device to conduct digital currency transactions.
[0142] In one possible implementation, the processing unit 502 is specifically configured to: transfer digital currency from the wallet of the payment device to the wallet of the receiving device upon successful verification.
[0143] In one possible implementation, the payment device further includes a sending unit 503, which is used to send identity credential information and encrypted information to the payment device when the payment device is connected to the network.
[0144] In one possible implementation, the encrypted information includes a public key certificate; the sending unit 503 is specifically used to: encrypt the identity credential information when the payment device is connected to the network, and send the encrypted identity credential information and the encrypted information including the public key certificate to the payment device.
[0145] In one possible implementation, the offline payment code is generated by the payment device based on encrypted information. The encrypted information is generated by the payment device based on an agreed-upon key, a one-time password, a wallet ID, and a transaction timestamp. The one-time password is obtained by the payment device through a hash operation on the transaction time period and identity credential information. The processing unit 502 is specifically used to: decrypt the offline payment code according to the agreed-upon key to obtain the one-time password and the wallet ID; determine the timestamps before and after the transaction timestamp to obtain multiple timestamps; generate a set of one-time passwords based on the time periods corresponding to the multiple timestamps and the wallet ID; and compare the one-time password with the one-time passwords in the set of one-time passwords. If there is a one-time password in the set that is the same as the one-time password, the verification is successful.
[0146] In one possible implementation, the processing unit 502 is specifically used to: obtain the ID of the wallet in the payment device, obtain the corresponding identity credential information based on the wallet ID; and perform hash operations on each time period and the identity credential information to obtain a set of one-time passwords.
[0147] In one possible implementation, the processing unit 502 is specifically used to: obtain a temporary random number used by the payment device, and determine a process key based on the agreed key and the temporary random number; and decrypt the encrypted information in the offline payment code based on the process key to obtain a one-time password and a wallet ID.
[0148] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0149] Figure 9 This is a block diagram illustrating an electronic device according to an exemplary embodiment. Figure 9 As shown, the electronic device 60 includes, but is not limited to, a processor 601 and a memory 602.
[0150] The aforementioned memory 602 is used to store the executable instructions of the aforementioned processor 601. It is understood that the processor 601 is configured to execute instructions to implement the offline payment method in the above embodiments.
[0151] It should be noted that those skilled in the art will understand that Figure 9 The electronic device structure shown does not constitute a limitation on the electronic device; the electronic device may include, but is not limited to, other electronic devices. Figure 9 This may indicate more or fewer components, or combinations of certain components, or different component arrangements.
[0152] Processor 601 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines. By running or executing software programs and / or modules stored in memory 602, and by calling data stored in memory 602, it performs various functions and processes data, thereby providing overall monitoring of the electronic device. Processor 601 may include one or more processing units; optionally, processor 601 may integrate an application processor and a modem processor. The application processor mainly handles the operating system, user interface, and applications, while the modem processor mainly handles wireless communication. It is understood that the aforementioned modem processor can also be integrated into processor 601.
[0153] The memory 602 can be used to store software programs and various data. The memory 602 may primarily include a program storage area and a data storage area, wherein the program storage area may store the operating system, application programs required by at least one functional module, etc. Furthermore, the memory 602 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0154] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 602 including instructions, which can be executed by a processor 601 of an electronic device 60 to implement the offline payment method in the above embodiments.
[0155] In actual implementation, Figure 7 The processing functions of the acquisition unit 401, processing unit 402, and generation unit 403 can all be provided by... Figure 9 The processor 601 calls the computer program stored in the memory 602 to implement the payment. The specific execution process can be found in the description of the offline payment method section of the previous embodiment, and will not be repeated here.
[0156] in addition, Figure 8 The processing functions of the receiving unit 501 and the processing unit 502 can both be provided by Figure 9 The processor 601 calls the computer program stored in the memory 602 to implement the payment. The specific execution process can be found in the description of the offline payment method section of the previous embodiment, and will not be repeated here.
[0157] Optionally, the computer-readable storage medium may be a non-transitory computer-readable storage medium, such as a read-only memory (ROM), a random access memory (RAM), a CD-ROM, magnetic tape, a floppy disk, and an optical data storage device.
[0158] In an exemplary embodiment, this application also provides a computer program product including one or more instructions, which can be executed by the processor 601 of the electronic device 60 to complete the offline payment method in the above embodiments.
[0159] It should be noted that when one or more instructions in the computer-readable storage medium or computer program product are executed by the processor 601 of the electronic device 60, they implement the various processes of the above-described offline payment method embodiments and achieve the same technical effect as the above-described offline payment method. To avoid repetition, they will not be described again here.
[0160] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0161] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another apparatus, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0162] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the classified units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0163] Furthermore, the functional units in the various embodiments of this application can be integrated into a single processor, or each unit can exist physically separately, or two or more units can be integrated into a single unit. The integrated units described above can be implemented in hardware or as software functional units.
[0164] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, essentially, or the part that contributes to the prior art, or a complete or partial classification of the technical solution, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0165] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. An offline payment method, characterized in that, The method is applied to a payment device, the payment device including a wallet, the wallet including a secure element, the secure element storing identity credential information and encrypted information; the encrypted information including an agreed-upon key and a public key certificate; the method includes: When the payment device is connected to the network, it receives encrypted identity credential information and the encrypted information sent by the server; it performs signature verification on the public key certificate, and if the verification is successful, it stores the encrypted identity credential information and the encrypted information in the secure element. When the payment device is offline, in response to the user's payment request, the identity credential information and the encryption information in the security element are obtained, and the transaction timestamp and transaction time period are determined based on the current timestamp; A hash operation is performed on the transaction time period and the identity credential information to obtain a one-time password; A process key is determined based on the agreed key and a temporary random number. The process key is a randomly generated encryption and decryption key used to ensure a secure communication session between the payment device and the server. The one-time password, the wallet ID, and the transaction timestamp are encrypted using the process key to generate ciphertext information. An offline payment code is generated based on the ciphertext information. The offline payment code is displayed to the receiving device so that the receiving device can verify the offline payment code through the wallet's server and conduct a digital currency transaction if the verification is successful.
2. The offline payment method according to claim 1, characterized in that, The payment device is a payment terminal or a hardware wallet; When the payment device is the payment terminal, and the payment terminal is equipped with payment software, the step of obtaining the identity credential information and the encryption information in the security element in response to a user's payment request operation when the payment device is offline includes: obtaining the identity credential information and the encryption information in the security element in response to a user's payment request operation through the payment software when the payment terminal is offline; When the payment device is the hardware wallet, and the hardware wallet is equipped with a payment request button, the step of obtaining the identity credential information and the encryption information in the security element in response to the user's payment request operation when the payment device is offline includes: when the hardware wallet is offline, in response to the user's payment request operation generated by the payment request button, obtaining the identity credential information and the encryption information in the security element.
3. The offline payment method according to claim 1, characterized in that, The identity credential information is the payment information corresponding to the ID of the wallet in the payment device; the method further includes: receiving the payment information sent by the server when the payment device is connected to the network.
4. The offline payment method according to claim 2, characterized in that, The method further includes: When the payment terminal is connected to the network and successfully logs into the payment software, it receives the identity credential information and the encrypted information sent by the server. The identity credential information and the encrypted information are stored in the secure element.
5. The offline payment method according to claim 2, characterized in that, The method further includes: When the hardware wallet is connected to the network and the user has activated the hardware wallet, the system receives the identity credential information and the encrypted information sent by the server. The identity credential information and the encrypted information are stored in the secure element.
6. The offline payment method according to any one of claims 2-5, characterized in that, The method further includes: When the payment device is offline, in response to the user's payment request operation, the user's current number of offline transactions is determined; If the current number of offline transactions is greater than or equal to a preset threshold, a reminder message is generated; the reminder message is used to remind the user to update the identity credential information via the internet.
7. The offline payment method according to claim 6, characterized in that, After generating the reminder information, the method further includes: When the hardware wallet switches from offline to online, the identity credential information is updated, and the current offline transaction count is reset.
8. The offline payment method according to claim 6, characterized in that, After generating the reminder information, the method further includes: When the payment terminal switches from offline to online and successfully logs back into the payment software, the identity credential information is updated and the current number of offline transactions is reset.
9. The offline payment method according to claim 1, characterized in that, The secure element also stores the user's payment password; the encryption of the one-time password, the wallet ID, and the transaction timestamp using the process key to generate ciphertext information includes: If the current payment limit of the payment device is greater than the user's preset password-free payment limit, the encrypted information is generated based on the agreed key, the one-time password, the wallet ID, the current timestamp, and the payment password.
10. An offline payment method, characterized in that, Applied to a server-side application, the server is used to provide payment services to payment devices, including wallets; the method includes: When the payment device is connected to the network, the identity credential information is encrypted, and the encrypted identity credential information, including the public key certificate, is sent to the payment device. When the payment device is offline, the offline payment code of the payment device is received forwarded by the receiving device; the offline payment code is generated by the payment device based on encrypted information, which is generated by the payment device according to the agreed key, one-time password, wallet ID, and transaction timestamp; the one-time password is obtained by the payment device by hashing the transaction time period and the identity credential information. The offline payment code is decrypted using the agreed key to obtain the one-time password and the wallet ID; the timestamps before and after the transaction timestamp are determined to obtain multiple timestamps; a set of one-time passwords is generated based on the time periods corresponding to the multiple timestamps and the wallet ID; the one-time password is compared with the one-time passwords in the set of one-time passwords, and if there is a one-time password in the set that is the same as the one-time password, the verification is successful, and if the verification is successful, the payment device and the receiving device are allowed to conduct a digital currency transaction.
11. The offline payment method according to claim 10, characterized in that, The step of agreeing to allow the payment device and the receiving device to conduct digital currency transactions upon successful verification includes: If the verification is successful, the digital currency in the wallet of the payment device will be transferred to the wallet of the receiving device.
12. The offline payment method according to claim 10, characterized in that, The method further includes: When the payment device is connected to the network, the identity credential information and the encrypted information are sent to the payment device.
13. The offline payment method according to claim 10, characterized in that, The step of generating a set of one-time passwords based on the time periods corresponding to the multiple timestamps and the wallet ID includes: Obtain the ID of the wallet in the payment device, and obtain the corresponding identity credential information based on the wallet ID; A hash operation is performed on the time periods and the identity credential information to obtain the set of one-time passwords.
14. The offline payment method according to claim 10, characterized in that, The step of decrypting the offline payment code according to the agreed key to obtain the one-time password and the wallet ID includes: Obtain the temporary random number used by the payment device, and determine the process key based on the agreed key and the temporary random number; Based on the process key, the encrypted information in the offline payment code is decrypted to obtain the one-time password and the wallet ID.
15. A payment system, characterized in that, The payment system includes a payment device, a receiving device, and a server; the payment device includes a wallet, the wallet includes a security element, and the security element stores identity credential information and encrypted information; the encrypted information includes an agreed-upon key and a public key certificate. The payment device is configured to receive encrypted identity credential information and the encrypted information sent by the server when the payment device is connected to the network. The public key certificate is signed and verified. If the verification is successful, the encrypted identity credential information and the encrypted information are stored in the secure element. The payment device is also configured to, in the event that the payment device is offline, respond to a user's payment request operation, obtain the identity credential information and the encryption information in the security element, and determine the transaction timestamp and transaction time period based on the current timestamp; The payment device is further configured to perform a hash operation on the transaction time period and the identity credential information to obtain a one-time password, and determine a process key based on the agreed key and a temporary random number; the process key is a randomly generated encryption and decryption key to ensure a secure communication session between the payment device and the server. The one-time password, the wallet ID, and the transaction timestamp are encrypted using the process key to generate ciphertext information, and an offline payment code is generated based on the ciphertext information. The offline payment code is used to display to the payment receiving device so that the payment receiving device can verify the offline payment code through the server of the wallet and conduct digital currency transactions if the verification is successful. The payment receiving device is used to obtain the offline payment code and send the offline payment code to the server; The server is configured to receive the offline payment code of the payment device forwarded by the receiving device when the payment device is offline, verify the offline payment code according to the agreed key, and, if the verification is successful, agree to the digital currency transaction between the payment device and the receiving device.
16. A payment device, characterized in that, The invention relates to a payment device, which includes a wallet, a security element, and an encryption element storing identity credential information and encrypted information; the encrypted information includes an agreed-upon key and a public key certificate; the device includes an acquisition unit, a processing unit, and a generation unit. The acquisition unit is used to receive encrypted identity credential information and the encrypted information sent by the server when the payment device is connected to the network. The public key certificate is signed and verified. If the verification is successful, the encrypted identity credential information and the encrypted information are stored in the secure element. The acquisition unit is further configured to, in response to a user's payment request operation, acquire the identity credential information and the encryption information in the security element when the payment device is offline, and determine the transaction timestamp and transaction time period based on the current timestamp; The processing unit is used to perform a hash operation on the transaction time period and the identity credential information to obtain a one-time password; The generation unit is used to determine the process key based on the agreed key and the temporary random number; the process key is an encryption and decryption key randomly generated to ensure a secure communication session between the payment device and the server. The one-time password, the wallet ID, and the transaction timestamp are encrypted using the process key to generate ciphertext information, and an offline payment code is generated based on the ciphertext information. The offline payment code is displayed to the payment receiving device, which then verifies the offline payment code through the wallet's server and performs a digital currency transaction if the verification is successful.
17. A payment device, characterized in that, The application is on a server-side device, which provides payment services to payment devices including wallets; the device includes a receiving unit and a processing unit. The receiving unit is configured to encrypt the identity credential information when the payment device is connected to the network, and send the encrypted identity credential information and encrypted information including the public key certificate to the payment device. The receiving unit is also configured to receive the offline payment code of the payment device forwarded by the receiving device when the payment device is offline; The offline payment code is generated by the payment device based on encrypted information. The encrypted information is generated by the payment device based on the agreed key, one-time password, wallet ID, and transaction timestamp. The one-time password is obtained by the payment device through hashing the transaction time period and the identity credential information. The processing unit is used to decrypt the offline payment code according to the agreed key to obtain the one-time password and the wallet ID; Determine the timestamps before and after the transaction timestamp to obtain multiple timestamps; Based on the time periods corresponding to the multiple timestamps and the ID of the wallet, a set of one-time passwords is generated; The one-time password is compared with one-time passwords in the set of one-time passwords. If there is a one-time password in the set that is the same as the one-time password, the verification is successful. If the verification is successful, the payment device and the receiving device are allowed to conduct a digital currency transaction.
18. An electronic device, characterized in that, The electronic device includes: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the offline payment method performed by the payment device or server as described in any one of claims 1-14.
19. A computer-readable storage medium, characterized in that, When the computer-executable instructions stored in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is capable of performing the offline payment method performed by the payment device or server as described in any one of claims 1-14.