Off-line payment method, system and device and storage medium
By generating one-time password and ciphertext information in the secure elements of the payment device, the problem that users cannot pay in an offline environment is solved, secure offline payment is achieved, external attacks are prevented, and payment security is ensured.
Patent Information
- Application Number
- CN202310652677.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-02
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2043-06-02
AI Technical Summary
Users cannot use payment codes to make payments in poor network conditions or offline environments, resulting in inconvenience in payment and lack of solutions to ensure payment security.
Store identity credential information and encrypted information in the secure elements of the payment device, generate a one-time password using the current timestamp, and generate ciphertext information based on the agreed key, one-time password, wallet ID and transaction timestamp, and generate offline payment codes , for verification of the collection device to ensure digital currency transactions are conducted offline.
It realizes that users can safely use payment codes to make payments when offline, solving the problem that users cannot pay in a network-free environment. At the same time, the identity credential information stored in the security element prevents external malicious resolution attacks, ensuring payment Security.
Smart Images

Figure CN119067650A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of mobile payment technology, and in particular to an offline payment method, system, device and storage medium. Background Art
[0002] With the development of communication technology, the payment code function has been widely used in life and has brought great convenience to people's lives. When a user uses a payment terminal to make a payment, the payment terminal needs to maintain a network connection with the server. In this way, the server can generate a real-time payment code for the payment terminal after receiving the payment code request sent by the payment terminal, which is highly secure.
[0003] However, when the user is in an environment with poor network conditions or even no network (such as subways, remote mountainous areas, etc.), the above offline payment method cannot be used, which brings inconvenience to the user. Therefore, how to allow users to use payment codes to pay offline and ensure the security of payment is a technical problem that needs to be solved urgently. Summary of the invention
[0004] This application provides an offline payment method, system, device and storage medium, which is dedicated to allowing users to use payment codes to make payments offline and ensure the security of payments. The technical solution of this application is as follows:
[0005] According to a first aspect of an embodiment of the present application, an offline payment method is provided, which is applied to a payment device, wherein the payment device includes a wallet, the wallet includes a security element, and identity credential information and encryption information are stored in the security element; the encryption information includes an agreed key; the method includes: when the payment device is off-grid, in response to a payment request operation by a user, obtaining the identity credential information and encryption information in the security element, and determining a transaction timestamp and a transaction time period based on a 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 key, the one-time password, the wallet's 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 payment receiving device, so that the payment receiving device verifies the offline payment code through the wallet's server, and performs a digital currency transaction when 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, the payment terminal is installed with payment software, and when the payment device is off-grid, in response to a payment request operation of a user, identity credential information and encryption information in a security element are obtained, including: when the payment terminal is off-grid, in response to a payment request operation performed by a user through the payment software, identity credential information and encryption information in the security element are obtained; when the payment device is a hardware wallet, the hardware wallet is provided with a payment request button, and when the payment device is off-grid, in response to a payment request operation of a user, identity credential information and encryption information in the security element are obtained, including: when the hardware wallet is off-grid, in response to a payment request operation generated by a user through a payment request button, identity credential information and encryption information in the security element are obtained.
[0007] In a possible implementation, the identity credential information is payment information corresponding to the ID of the wallet in the payment device; the method further includes: when the payment device is connected to the Internet, receiving the payment information sent by the service end.
[0008] In a possible implementation, ciphertext information is generated according to an agreed key, a one-time password, a wallet ID, and a transaction timestamp, including: determining a process key according to the agreed key and a temporary random number; encrypting the one-time password, the wallet ID, and the transaction timestamp according to the process key to obtain ciphertext information.
[0009] In a possible implementation, the method further includes: when the payment terminal is connected to the Internet and the payment terminal successfully logs into the payment software, receiving identity credential information and encryption information sent by the server; and storing the identity credential information and encryption information in a security element.
[0010] In a possible implementation, the method further includes: when the hardware wallet is connected to the Internet and the user activates the hardware wallet, receiving identity credential information and encryption information sent by the server; and storing the identity credential information and encryption 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 identity credential information encrypted by the server; when the payment terminal is connected to the network and the payment terminal successfully logs into the payment software, the identity credential information and the encrypted information sent by the server of the payment software are received, and the identity credential information and the encrypted information are stored in a security element, including: when the payment terminal is connected to the network and the payment terminal successfully logs into the payment software, the encrypted identity credential information and the encrypted information are received from the server; a signature verification is performed on the public key certificate in the encrypted information, and if the verification passes, the encrypted identity credential information and the encrypted information are stored in the security element.
[0012] In a possible implementation, the method further includes: when the payment device is off-grid, in response to a payment request operation of the user account, determining the current number of offline transactions of the user account; when 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 the identity credential information through the Internet.
[0013] In a possible implementation, after generating the reminder information, the method further includes: when the hardware wallet is converted from off-grid to online, updating the identity credential information and resetting the current number of offline transactions.
[0014] In a possible implementation, after generating the reminder information, the method further includes: when the payment terminal is converted from off-network to online and the payment terminal successfully logs into the payment software again, updating the identity credential information and resetting the current offline transaction count.
[0015] In a possible implementation, the user's payment password is also stored in the security element; ciphertext information is generated based on the agreed secret key, the one-time password, the wallet's ID, and the current timestamp, including: when the current payment amount of the payment device is greater than the user's preset password-free payment amount, ciphertext information is generated based on the agreed secret key, the one-time password, the wallet's ID, the current timestamp and the payment password.
[0016] According to a second aspect of an embodiment of the present application, an offline payment method is provided, which is applied to a server, and the server is used to provide payment services for a payment device including a wallet; the method comprises: when the payment device is off-grid, receiving an offline payment code of the payment device forwarded by a payment receiving device; the offline payment code is generated by the payment device based on an agreed key in encrypted information and identity credential information; the offline payment code is verified according to the agreed key, and when the verification passes, the payment device and the payment receiving device are allowed to conduct digital currency transactions.
[0017] In a possible implementation, if the verification is successful, agreeing to the digital currency transaction between the payment device and the payment device includes: if the verification is successful, transferring the digital currency in the wallet of the payment device to the wallet of the payment device.
[0018] In a possible implementation, the method further includes: when the payment device is connected to a network, sending the identity credential information and the encrypted information to the payment device.
[0019] In one possible implementation, the encrypted information includes a public key certificate; when the payment device is connected to an Internet connection, the identity credential information and the encrypted information are sent to the payment device, including: when the payment device is connected to an Internet connection, the identity credential information is encrypting, and the encrypted identity credential information and the encrypted information including the public key certificate are sent to the payment device.
[0020] In a possible implementation, the offline payment code is generated by the payment device based on ciphertext information, the ciphertext information is generated by the payment device according to an agreed secret key, a one-time password, a wallet ID, and a transaction timestamp, and the one-time password is obtained by the payment device performing a hash operation on the transaction time period and identity credential information; the offline payment code is verified according to the agreed key, including: decrypting the offline payment code according to the agreed key to obtain the one-time password and the wallet ID; determining a timestamp before the transaction timestamp and a timestamp after the transaction timestamp to obtain multiple timestamps; generating a one-time password set based on each time period and the wallet ID corresponding to the multiple timestamps; comparing the one-time password with the one-time password in the one-time password set, and if there is a one-time password in the one-time password set that is identical to the one-time password, the verification is successful.
[0021] In a possible implementation, a one-time password set is generated based on each time period corresponding to a plurality of timestamps and a wallet ID, including: obtaining the ID of the wallet in the payment device, and obtaining corresponding identity credential information according to the wallet ID; performing a hash operation on each time period and the identity credential information to obtain the one-time password set.
[0022] In a possible implementation, the offline payment code is decrypted according to the agreed key to obtain the one-time password and the wallet ID, including: obtaining a temporary random number used by the payment device, and determining a process key according to the agreed key and the temporary random number; decrypting the ciphertext information in the offline payment code according to the process key to obtain the one-time password and the wallet ID.
[0023] According to a third aspect of an embodiment of the present application, a payment system is provided, the payment system comprising a payment device, a payment receiving device and a server; the payment device comprises a wallet, the wallet comprises a security element, identity credential information and encryption information are stored in the security element; the encryption information comprises an agreed key; the payment device is used to, when the payment device is off-grid, respond to a payment request operation of a user, obtain the identity credential information and encryption information in the security element, and determine a transaction timestamp and a transaction time period according to a current timestamp; the payment device is further used to perform a hash operation on the transaction time period and the identity credential information to obtain a one-time password, and to perform a one-time password according to the agreed key. , one-time password, wallet ID, and transaction timestamp generate ciphertext information, and generate an offline payment code based on the ciphertext information; the offline payment code is used to display to the payment device, so that the payment device can verify the offline payment code through the wallet's server, and conduct digital currency transactions when the verification is successful; the payment device is used to obtain the offline payment code and send the offline payment code to the server; the server is used to receive the offline payment code of the payment device forwarded by the payment device when the payment device is off-grid, verify the offline payment code according to the agreed key, and agree to the digital currency transaction between the payment device and the payment device when the verification is successful.
[0024] According to a fourth aspect of an embodiment of the present application, a payment device is provided, which is applied to a payment device, the payment device comprising a wallet, the wallet comprising a security element, identity credential information and encryption information stored in the security element; the encryption information comprises an agreed key; the device comprises an acquisition unit, a processing unit and a generation unit; the acquisition unit is used to, when the payment device is off-grid, in response to a payment request operation of a user, acquire the identity credential information and encryption information in the security element, and determine a transaction timestamp and a transaction time period according to a 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 generate ciphertext information according to the agreed key, the one-time password, the wallet's ID, and the transaction timestamp, and generate an offline payment code according to the ciphertext information; the offline payment code is used to display it to a payment receiving device, so that the payment receiving device verifies the offline payment code through the wallet's server, and performs digital currency transactions when 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 off-grid, in response to a payment request operation performed by a user through a payment software, obtain 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 off-grid, in response to a payment request operation generated by the user through the payment request button, obtain the identity credential information and encryption information in the security element.
[0026] In a possible implementation, the identity credential information is payment information corresponding to the ID of the wallet in the payment device; the acquisition unit is further used to: when the payment device is connected to the Internet, receive the payment information sent by the server.
[0027] In a possible implementation, the generation unit is specifically used to: determine a process key according to an agreed key and a temporary random number; encrypt a one-time password, a wallet ID, and a transaction timestamp according to the process key to obtain ciphertext information.
[0028] In a possible implementation, the acquisition unit is further used to: when the payment terminal is connected to the Internet and the payment terminal successfully logs into the payment software, receive the identity credential information and encryption information sent by the server; and store the identity credential information and encryption information in the security element.
[0029] In a possible implementation, the acquisition unit is further used to: when the hardware wallet is connected to the Internet and the user activates the hardware wallet, receive the identity credential information and the encrypted information sent by the server; and store the identity credential information and the encrypted information in the security element.
[0030] In one possible implementation, the encrypted information includes a public key certificate, and the identity credential information is the identity credential information encrypted by the server; the acquisition unit is specifically used to: when the payment terminal is connected to the Internet and the payment terminal successfully logs into the payment software, receive the encrypted identity credential information and the encrypted information sent by the server; perform signature verification on the public key certificate in the encrypted information, and if the verification passes, store the encrypted identity credential information and the encrypted information in the security element.
[0031] In one possible implementation, the processing unit is further used to: when the payment device is off-grid, in response to a payment request operation of the user account, determine the current number of offline transactions of the user account; when the current number of offline transactions is greater than or equal to a preset threshold, generate a reminder message; the reminder message is used to remind the user to update the identity credential information through the Internet.
[0032] In a 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 hardware wallet is switched from off-grid to online.
[0033] In a possible implementation, after generating the reminder information, the processing unit is further used to: when the payment terminal is converted from off-network to online and the payment terminal successfully logs into the payment software again, update the identity credential information and reset the current offline transaction count.
[0034] In a possible implementation, the user's payment password is also stored in the security element; the generation unit is specifically used to: when the current payment amount of the payment device is greater than the user's preset password-free payment amount, generate ciphertext information according to the agreed secret key, one-time password, wallet ID, current timestamp and payment password.
[0035] According to a fifth aspect of an embodiment of the present application, a payment device is provided, which is applied to a server side, and the server side is used to provide payment services for a payment device including a wallet; 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 off-network; 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 when the verification is passed, agree to the payment device and the receiving device to conduct digital currency transactions.
[0036] In a possible implementation, the processing unit is specifically configured to: if the verification is successful, transfer the digital currency in the wallet of the payment device to the wallet of the payment device.
[0037] In a possible implementation, the payment device further includes a sending unit, and the sending unit is used to send the identity credential information and the encrypted information to the payment device when the payment device is connected to a network.
[0038] In a possible implementation, the encrypted information includes a public key certificate; the sending unit is specifically used to: when the payment device is connected to the Internet, encrypt the identity credential information, and send the encrypted identity credential information and the encrypted information including the public key certificate to the payment device.
[0039] In a possible implementation, the offline payment code is generated by the payment device based on ciphertext information, the ciphertext information is generated by the payment device according to the agreed secret key, the one-time password, the wallet ID, and the transaction timestamp, and the one-time password is obtained by the payment device performing a hash operation on the transaction time period and the identity credential information; the processing unit is specifically used to: decrypt the offline payment code according to the agreed key to obtain the one-time password and the wallet ID; determine the timestamp before the transaction timestamp and the timestamp after the transaction timestamp to obtain multiple timestamps; generate a one-time password set based on the time periods and the wallet ID corresponding to the multiple timestamps; compare the one-time password with the one-time password in the one-time password set, and if there is a one-time password in the one-time password set that is the same as the one-time password, the verification is successful.
[0040] In a possible implementation, the processing unit is specifically used to: obtain the ID of the wallet in the payment device, and obtain the corresponding identity credential information according to the ID of the wallet; perform hash operations on each time period and the identity credential information to obtain a one-time password set.
[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; decrypt the ciphertext information in the offline payment code based on the process key to obtain a one-time password and a wallet ID.
[0042] According to the sixth aspect of an embodiment of the present application, an electronic device is provided, comprising: a processor; a memory for storing processor executable instructions; wherein the processor is configured to execute instructions to implement an offline payment method as described in the first aspect or the second aspect above.
[0043] According to the seventh aspect of the embodiments of the present application, a computer-readable storage medium is provided. When the computer execution instructions stored in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can execute the offline payment method as described in the first aspect or the second aspect above.
[0044] According to an eighth aspect of the embodiments of the present application, a computer program product is provided, the computer program product comprising computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the offline payment method of the first aspect or the second aspect described above.
[0045] The technical solution of the first aspect provided by the embodiment of the present application brings at least the following beneficial effects: the offline payment method provided by the present application can be applied to a payment device including a wallet, the wallet including a security element, the security element storing identity credential information and encryption information, the encryption information including an agreed key. Therefore, when the payment device is off-grid, in response to the user's payment request operation, the payment device can obtain the identity credential information and encryption information from the security 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 the identity credential information to obtain a one-time password, and generates ciphertext information based on the agreed secret key, the one-time password, the wallet's ID, and the transaction timestamp to ensure the security of payment when off-grid. In this way, when the payment device is off-grid, it can use the identity credential information and encryption information stored in the security element to generate a payment code locally without relying on the server, which solves the problem that users cannot use payment codes to pay when they are offline. In addition, since the identity credential information is stored in the security element, it can prevent external malicious parsing attacks and protect data security. At the same time, the payment device generates an offline payment code based on the encrypted information, so that the server will only allow the payment device to pay if the verification is passed, further ensuring the security of payment in offline situations.
[0046] It should be noted that the technical effects brought about by any implementation method in the second to eighth aspects can refer to the technical effects brought about by the corresponding implementation method in the first aspect, and will not be repeated here.
[0047] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification are used to explain the principles of the present application, and do not constitute an improper limitation on the present application.
[0049] Figure 1 is a schematic diagram of the structure of a payment system according to an exemplary embodiment;
[0050] Figure 2 is a payment flow chart in an offline scenario according to an exemplary embodiment;
[0051] Figure 3 is one of the flow charts of an offline payment method according to an exemplary embodiment;
[0052] Figure 4 This is a second flowchart of an offline payment method according to an exemplary embodiment;
[0053] Figure 5 This is a third flowchart of an offline payment method according to an exemplary embodiment;
[0054] Figure 6 This is a fourth flow chart of an offline payment method according to an exemplary embodiment;
[0055] Figure 7 is one of the structural schematic diagrams of a payment device according to an exemplary embodiment;
[0056] Figure 8 is a second structural schematic diagram of a payment device according to an exemplary embodiment;
[0057] Fig. 9 The diagram is a schematic structural diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0058] In order to enable ordinary persons in the art to better understand the technical solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0059] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.
[0060] In addition, in the description of the embodiments of the present disclosure, unless otherwise specified, " / " means or, for example, A / B can mean A or B. "And / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present disclosure, "multiple" means two or more than two.
[0061] In addition, 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 explaining the embodiments of the present application in detail, some relevant technical terms and related technologies involved in the embodiments of the present application are first introduced.
[0063] Digital currency (DC) is an alternative currency in the form of electronic money. For example, the digital RMB is issued by the People's Bank of China, operated by designated operating institutions and exchanged to the public. It is based on a broad account system, supports loose coupling with bank accounts, is equivalent to paper money and coins, and is a controllable and anonymous payment tool with value characteristics and legal tender.
[0064] A secure element (SE) is usually provided in the form of a chip. To prevent external malicious parsing attacks and protect data security, the chip has encryption / decryption logic circuits.
[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] QR Code (Quick Response Code) is also called two-dimensional barcode. The most common QR Code is QR Code, QR stands for Quick Response, which is a coding method. It can store more information and represent more data types than traditional barcodes.
[0067] At present, there are more and more application scenarios of QR code payment based on digital currency, but they all rely on the network. The process of generating QR codes must ensure that the payment terminal and the server maintain network connection, that is, the QR code generation method is online. Specifically, when the user uses the payment terminal to make a payment operation, the payment terminal needs to maintain a network connection with the server, so that the server can generate a real-time QR code for payment for the payment terminal after receiving the request for obtaining the payment code sent by the payment terminal, which is more secure.
[0068] However, when the user is in an environment with poor network conditions or even without network (such as subways, remote mountainous areas, etc.), the above offline payment method cannot be performed, which brings inconvenience to the user.
[0069] In view of the above technical problems, the present application provides an offline payment method, which introduces offline QR code security generation technology. Based on the SE chip, the method uses the digital certificate authentication technology of the domestic cryptographic algorithm and the one-time password (OTP) technology to ensure the legitimacy of the visitor's identity to prevent the key from being illegally stolen or tampered with, thereby improving the security of data transmission, making it impossible to forge the offline generated QR code, and supporting the offline payment method while also improving the security of the offline payment method.
[0070] The method provided in the embodiment of the present application is described in detail below with reference to the accompanying drawings.
[0071] Figure 1 FIG. 1 shows an exemplary application scenario diagram provided by an embodiment of the present application. Figure 1 As shown, the offline payment method provided in the embodiment of the present application can be applied to the payment system 10. The payment system 10 includes a payment device 11, a payment receiving device 12, and a server 13. The server 13 is connected to the payment device 11 and the payment receiving device 12 respectively. The server 13 can be connected to the payment device 11 or the payment receiving device 12 by wire or by wireless, which is not limited in the embodiment of the present application.
[0072] The payment device 11 can be any payment terminal used by the user, such as a smart phone, a smart watch, etc. The payment device 11 can also be a hardware wallet. Compared with the payment terminal, the hardware wallet has a relatively simple structure, for example, only including some basic buttons (such as a payment request button), a display screen, and a communication module.
[0073] The payment device 11 includes a wallet (the wallet is composed of hardware and software), for example, the hardware part includes a security element, and the software part includes payment software. The payment software can be any software with a specific payment function, such as a digital currency APP, and the embodiment of the present application does not limit the specific payment software.
[0074] Optionally, the security element may be independently embedded in the payment device 11, or may be embedded in a SIM card of the payment device 11. The security element stores identity credential information and encryption information, and the encryption information includes an agreed key.
[0075] The payment device 11 is used to obtain the identity credential information and encryption information in the security element in response to the user's payment request operation when the payment device is off-grid, and perform hash operation on the transaction time period and the identity credential information to obtain a one-time password. The payment device 11 is also used to generate ciphertext information based on the agreed secret key, the one-time password, the wallet ID, and the transaction timestamp, and to generate an offline payment code based on the ciphertext information; the offline payment code is used to display to the payment receiving device so that the payment receiving device verifies the offline payment code through the wallet's server, and conducts digital currency transactions if the verification is successful.
[0076] The payment collection device 12 may be any terminal device with a payment collection function used by a merchant, such as a cash register.
[0077] The payment 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 service end 13 .
[0078] The server 13 may be a server with financial service functions, such as a bank server corresponding to the wallet on the payment device 11 .
[0079] The server 13 is used to receive the offline payment code of the payment device forwarded by the payment receiving device when the payment device is offline. The server 13 is also used to verify the offline payment code according to the agreed key, and if the verification is successful, the payment device and the payment receiving device are allowed to conduct digital currency transactions.
[0080] For example, Figure 2 As shown, in the scenario where the buyer uses a smartphone to pay when off-line, after the merchant uses the cash register to place an order, the background system corresponding to the cash register generates a system order to indicate the amount of the collection. The buyer generates an offline payment code through the smartphone and shows it to the merchant first. The merchant scans the buyer's offline payment code through the scanning device of the cash register, so that the offline payment code is transmitted to the background system corresponding to the cash register. Furthermore, the background system of the cash register sends the offline payment code to the bank server by calling the preset payment interface. After receiving the offline payment code, the bank server verifies it. If the verification is passed, the deduction of the buyer's account is completed, and the deduction result is returned to the cash register. After receiving the deduction result, the cash register prints a receipt for the buyer.
[0081] Figure 3 is a flowchart of an offline payment method according to some exemplary embodiments. In some embodiments, the above offline payment method can be applied to Figure 1 The payment system shown, such as the payment device and the server, can also be applied to other similar devices.
[0082] like Figure 3As shown, the offline payment method provided in the embodiment of the present application includes the following S201-S205.
[0083] S201. When the payment device is off-grid, the payment device responds to the user's payment request operation, obtains identity credential information and encryption information in the security element, and determines a transaction timestamp and a transaction time period according to a current timestamp.
[0084] As a possible implementation, in the case where the payment device is a payment terminal, the payment terminal is installed with payment software. In the case where the payment terminal is off-grid, when the user needs to make a payment, the user performs a payment request operation on the payment software of the payment device. Accordingly, the payment device responds to the payment request operation performed by the user through the payment software, obtains the identity credential information and encryption information in the security element, and determines the current timestamp. Further, the payment device uses the current timestamp as the transaction timestamp, and uses the preset time period after the current timestamp as the transaction time period.
[0085] It should be noted that the identity credential information and encryption information are pre-stored in the security element by the payment device, which can prevent external malicious parsing attacks. Only when the payment device is off-grid and the user has payment needs, the payment device will read the identity credential information and encryption information from the security element. When the payment device is connected to the Internet, if the user needs to make a payment, the payment device can obtain a temporary payment code from the server through the network to pay the payment device.
[0086] The identity credential information may be the payment information corresponding to the ID of the wallet in the payment device, which includes but is not limited to the account information recorded on the UnionPay card, the network payment account information based on the UnionPay card for payment services, identity authentication information, necessary personal information involved in the payment service and other payment related information. For example, the payment information includes the user account's mobile phone number, name, ID 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 is provided with a payment request button. When the hardware wallet is off-grid, the payment device responds to the payment request operation generated by the user through the payment request button and obtains the identity credential information and encryption information in the security element.
[0088] S202: The payment device performs a hash operation on the transaction time period and identity credential information to obtain a one-time password.
[0089] As a possible implementation method, the payment device performs a hash operation on the transaction time period and the identity credential information through a hash function to obtain a hash value, also known as a one-time password (OTP).
[0090] S203. The payment device generates ciphertext information according to the agreed secret key, the one-time password, the wallet ID, and the transaction timestamp, and generates an offline payment code according to the ciphertext information.
[0091] Among them, the offline payment code is used to display to the payment device, so that the payment device can verify the offline payment code through the wallet's server, and conduct digital currency transactions if the verification is passed.
[0092] As a possible implementation method, the payment device determines the process key, also known as the session key, based on the agreed key and the temporary random number. Further, the payment device encrypts the one-time password, the wallet ID, and the transaction timestamp based on the process key to obtain ciphertext information. The payment device converts the ciphertext information into a matrix QR code according to a preset encoding method, and uses the 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 to ensure a secure communication session between the payment device and the server, which can be obtained through negotiation between the payment device and the server. It is generally generated dynamically and only when session data encryption is required. The specific generation method can refer to any national secret algorithm, for example, national secret algorithm SM3, national secret algorithm SM4, etc. The embodiment of this application does not limit the specific encryption algorithm.
[0094] In some embodiments, the payment device may also combine the OTP with other information (such as the model of the payment device, etc.) into a final matrix QR code to serve as an offline payment code.
[0095] In some embodiments, in order to ensure the timeliness of the offline payment code, the payment device updates the offline payment code once every specified time interval.
[0096] In actual applications, the agreed 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 key and the temporary random number, the payment device will also inform the server of the temporary random number (for example, add it to the offline payment code) so that the server can decrypt and use it.
[0097] S204: The server receives the offline payment code of the payment device forwarded by the payment receiving device.
[0098] As a possible implementation, when the payment device is offline, the payment device scans the offline payment code of the payment device and sends the scanned offline payment code to the server through the network. Correspondingly, the server receives the offline payment code of the payment device forwarded by the payment device.
[0099] It should be noted that although offline payment methods can be implemented for payment devices, the payment device usually needs to be online, so that the payment device can verify information with the server. The most important link in the offline payment method is the code scanning link. Through the online merchant bridge, the offline payment information is transmitted to the server for verification, thereby realizing the information interaction between offline and online, and then the payment device can also make payments when it is off-line.
[0100] S205. The server verifies the offline payment code according to the agreed key, and if the verification is successful, the server agrees to allow the payment device to conduct digital currency transactions with the payment device.
[0101] As a possible implementation method, the server decrypts the offline payment code according to the agreed key to obtain the one-time password, the wallet ID, and the transaction timestamp. Furthermore, the server verifies the one-time password. If the verification is successful, the server agrees that the payment device and the payment device can trade and provide payment services for the payment device. If the verification fails, the server refuses to allow the payment device to trade with the payment device.
[0102] In some embodiments, in order to verify the one-time password, the server can generate a one-time password set based on the time periods corresponding to the multiple timestamps and the wallet ID. Further, the server compares the one-time password with the one-time password in the one-time password set. If there is a one-time password in the one-time password set that is the same as the one-time password, the verification is successful.
[0103] Exemplarily, 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 decrypts the ciphertext information in the offline payment code based on the process key to obtain the one-time password, the wallet ID, and the transaction timestamp. Furthermore, the server performs a hash operation on each time period and identity credential information to obtain a one-time password set. The server compares the decrypted one-time password with the one-time password in the one-time password set one by one. If there are identical items, the verification is passed, otherwise the transaction is rejected.
[0104] In some embodiments, the server provides payment services to the payment device if verification is successful, and deducts money from the user account of the payment device based on the bill sent by the payment receiving device. After the deduction is successful, the server pushes the message notification or interface design (UI) to the payment software of the payment device.
[0105] For example, if the verification is successful, the server transfers the digital currency in the wallet of the payment device (also called the payment wallet) to the wallet of the payment device.
[0106] It should be noted that a payment wallet can be a wallet with a personal identity or a wallet without a personal identity.
[0107] During the transaction, if Figure 4 As shown, after the payment device generates an order, the user account displays the offline payment code through the numerical currency APP on the payment device. The payment device obtains the offline payment code by scanning, and calls the order payment interface to forward the offline payment code to the server. After receiving the offline payment code, the server verifies the offline payment code to determine whether it agrees to the payment device and the payment device to trade, and returns the transaction result to the payment device and the payment device. Among them, if the verification is passed, the server can indicate that the payment is successful in the form of code 0000, and display the payment success page on the numerical currency APP of the payment device. The server can also indicate waiting for payment in the form of code 1003, system abnormality, network timeout, etc. in the form of code 2000, and payment failure in the form of code 1004. Correspondingly, the payment device will cyclically call the order query interface during the waiting period to obtain the order status until the payment is successful or the polling time is exceeded. If the payment is still not successful after the polling is completed, the payment device calls the order closing interface to end the current transaction. After receiving the payment failure message fed back by the server, the payment device will check the called payment parameters and call the payment interface again to obtain the transaction result fed back by the server.
[0108] The above-mentioned embodiments provided by the present application have the following beneficial effects: the offline payment method provided by the present application can be applied to a payment device including a wallet, the wallet including a security element, the security element storing identity credential information and encryption information, the encryption information including an agreed key. Therefore, when the payment device is off-grid, in response to the user's payment request operation, the payment device can obtain the identity credential information and encryption information from the security 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 the identity credential information to obtain a one-time password, and generates ciphertext information based on the agreed secret key, the one-time password, the wallet's ID, and the transaction timestamp to ensure the security of payment when off-grid. In this way, when the payment device is off-grid, it can use the identity credential information and encryption information stored in the security element to generate a payment code locally without relying on the server, which solves the problem that users cannot use payment codes to pay when they are offline. In addition, since the identity credential information is stored in the security element, it can prevent external malicious parsing attacks and protect data security. At the same time, the payment device generates an offline payment code based on the encrypted information, so that the server will only allow the payment device to pay if the verification is passed, further ensuring the security of payment in offline situations.
[0109] In some embodiments, Figure 5 As shown, the server can verify the legitimacy of the user account by calling the certificate authorization and authentication center data interface of the Trusted Service Manager (TSM) to determine whether the user account has activated the offline payment method function. Correspondingly, the payment device applies for an offline QR code certificate from TSM, and TSM issues an offline QR code certificate to the payment device to enable the user account to activate the offline payment method function. Further, when the server determines that the user account has activated the offline payment method function, it sends offline payment information to the payment device so that the payment device can be used when it is off-line (including the payment device scanning the code and the server verification). In addition, when the payment device encrypts the payment information, it can also apply for an OTP seed from the OTP server (that is, the payment device sends the payment information to the OTP server and requests encryption), and accordingly, the OTP server returns the encryption result to the payment device (that is, issues the OTP seed). Similarly, when the server decrypts the offline payment code, it can also rely on the OTP server to obtain the verification result.
[0110] In one design, Figure 6 As shown, in order to support the payment device to make payment when it is off-line, the offline payment method provided in the embodiment of the present application further includes the following S301-S302:
[0111] S301: When the payment device is connected to the Internet, the server sends identity credential information and encrypted information to the payment device.
[0112] As a 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 and the encrypted information including the public key certificate to the payment device.
[0113] Exemplarily, the server may determine a process key based on an agreed key and a temporary random number, and encrypt the identity credential information based on the process key.
[0114] Optionally, the server may determine the identity credential information based on the wallet ID of the payment device.
[0115] Optionally, when the payment device logs in to the Digital RMB APP, the server can also obtain the user account when the payment device logs in, and generate a corresponding unique token information based on the user account, which contains the payment information of the user account.
[0116] It should be noted that a public key certificate, often referred to as a certificate, is a digitally signed statement that binds the value of a public key to the identity of the person, device, or service that holds the corresponding private key.
[0117] S302: The payment device receives the identity credential information and the encrypted information, and stores the identity credential information and the encrypted information in a secure element.
[0118] As a possible implementation, when the payment terminal is connected to the Internet and successfully logs into the payment software, the payment device receives the identity credential information and the encrypted information sent by the server, and stores the identity credential information and the encrypted information in the security element.
[0119] As another possible implementation, when the hardware wallet is connected to the Internet and the user activates the hardware wallet, the payment device receives the identity credential information and the encrypted information sent by the server, and stores the identity credential information and the encrypted information in the security element.
[0120] Exemplarily, the encrypted information includes a public key certificate, and the identity credential information is the identity credential information encrypted by the server. When the payment terminal is connected to the Internet and the payment terminal successfully logs 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 performs signature verification on the public key certificate in the encrypted information, and if the verification is successful, the encrypted identity credential information and the encrypted information are stored in the security element.
[0121] In one design, in order to ensure the data security within the SE, the payment device and the server will set the number of offline transactions (for example, a maximum of 12 times are allowed). When a certain number of offline transactions is reached, the payment software will prompt the user account to complete the update of payment information through online synchronization.
[0122] Optionally, when the payment device is converted from off-network to online and the payment device successfully logs into the payment software again, the payment information is updated through the above S301-S302 and the current offline transaction number is reset.
[0123] Optionally, for electronic card-type offline payment codes, the payment information can be updated using a payment device through contactless methods such as Bluetooth and Near Field Communication (NFC) or contact methods, or when the internal design is about to reach the maximum number of offline transactions, the electronic card type can use its own designed program to update the payment information.
[0124] In some embodiments, when the payment device performs an offline payment method, the payment amount cannot exceed the preset password-free payment amount of the user account. Usually, after the payment amount exceeds the password-free payment amount, the user account needs to enter the payment password on the payment software, but the payment device cannot send the payment password to the server when there is no network. Therefore, the payment device will store the payment password of the user account in the SE when connected to the network. When the current payment amount of the payment device is greater than the preset password-free payment amount of the user account, the payment device obtains the payment password in the security element and generates an offline payment code based on the one-time password and the payment password for verification by the server.
[0125] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. In order to realize the above functions, the payment device or electronic device includes a hardware structure and / or software module corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.
[0126] The embodiment of the present application can divide the functional modules of the payment device or electronic device according to the above method. For example, the payment device or electronic device can include various functional modules corresponding to the various functional divisions, or two or more functions can be integrated into one processing module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical functional division. There may be other division methods in actual implementation.
[0127] For example, an embodiment of the present application also provides a payment device.
[0128] Figure 7 is a block diagram of a payment device according to an exemplary embodiment. 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 off-grid, obtain the identity credential information and encryption information in the security element, and determine the transaction timestamp and transaction time period according to the current timestamp; the processing unit 402 is used to perform hash operation on the transaction time period and the identity credential information to obtain a one-time password; the generation unit 403 is used to generate ciphertext information according to the agreed secret key, the one-time password, the wallet ID, and the transaction timestamp, and generate an offline payment code according to the ciphertext information; the offline payment code is used to display to the payment receiving device so that the payment receiving device verifies the offline payment code through the wallet's server, and performs digital currency transactions when the verification is successful.
[0130] In a 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 off-grid, in response to a payment request operation performed by a user through a payment software, obtain 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 off-grid, in response to a payment request operation generated by a user through a payment request button, obtain the identity credential information and encryption information in the security element.
[0131] In a 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: when the payment device is connected to the Internet, receive the payment information sent by the server.
[0132] In a possible implementation, the generation unit 403 is specifically used to: determine a process key according to an agreed key and a temporary random number; and encrypt a one-time password, a wallet ID, and a transaction timestamp according to the process key to obtain ciphertext information.
[0133] In a possible implementation, the acquisition unit 401 is further used to: when the payment terminal is connected to the Internet and the payment terminal successfully logs into the payment software, receive the identity credential information and encryption information sent by the server; and store the identity credential information and encryption information in a security element.
[0134] In a possible implementation, the acquisition unit 401 is further used to: when the hardware wallet is connected to the Internet and the user activates the hardware wallet, receive the identity credential information and the encrypted information sent by the server; and store the identity credential information and the encrypted information in the security element.
[0135] In a possible implementation, the encrypted information includes a public key certificate, and the identity credential information is the identity credential information encrypted by the server; the acquisition unit 401 is specifically used to: when the payment terminal is connected to the Internet and the payment terminal successfully logs into the payment software, receive the encrypted identity credential information and the encrypted information sent by the server; perform signature verification on the public key certificate in the encrypted information, and if the verification passes, store the encrypted identity credential information and the encrypted information in the security element.
[0136] In one possible implementation, the processing unit 402 is further used to: when the payment device is off-grid, in response to a payment request operation of the user account, determine the current number of offline transactions of the user account; when the current number of offline transactions is greater than or equal to a preset threshold, generate a reminder message; the reminder message is used to remind the user to update the identity credential information through the Internet.
[0137] In a 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 hardware wallet is switched from off-network to online.
[0138] In a possible implementation, after generating the reminder information, the processing unit 402 is further used to: update the identity credential information and reset the current offline transaction count when the payment terminal is converted from off-network to online and the payment terminal successfully logs into the payment software again.
[0139] In one possible implementation, the user's payment password is also stored in the security element; the generation unit 403 is specifically used to: when the current payment amount of the payment device is greater than the user's preset password-free payment amount, generate ciphertext information based on the agreed secret key, one-time password, wallet ID, current timestamp and payment password.
[0140] Figure 8 is a block diagram of another payment device according to an exemplary embodiment. 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 payment receiving device when the payment device is off-network; the offline payment code is generated by the payment device based on the agreed key and identity credential information in the encrypted information; the processing unit 502 is used to verify the offline payment code according to the agreed key, and if the verification is successful, the payment device and the payment receiving device are allowed to conduct digital currency transactions.
[0142] In a possible implementation, the processing unit 502 is specifically configured to: if the verification is successful, transfer the digital currency in the wallet of the payment device to the wallet of the payment device.
[0143] In a possible implementation, the payment device further includes a sending unit 503, and the sending unit 503 is used to send identity credential information and encrypted information to the payment device when the payment device is connected to a network.
[0144] In a possible implementation, the encrypted information includes a public key certificate; the sending unit 503 is specifically used to: when the payment device is connected to the Internet, encrypt the identity credential information, and send the encrypted identity credential information and the encrypted information including the public key certificate to the payment device.
[0145] In a possible implementation, the offline payment code is generated by the payment device based on ciphertext information, the ciphertext information is generated by the payment device according to the agreed secret key, the one-time password, the wallet ID, and the transaction timestamp, and the one-time password is obtained by the payment device performing a hash operation on the transaction time period and the identity credential information; the processing unit 502 is specifically used to: decrypt the offline payment code according to the agreed key to obtain the one-time password and the wallet ID; determine the timestamp before the transaction timestamp and the timestamp after the transaction timestamp to obtain multiple timestamps; generate a one-time password set based on the time periods and wallet IDs corresponding to the multiple timestamps; compare the one-time password with the one-time password in the one-time password set, and if there is a one-time password in the one-time password set that is the same as the one-time password, the verification is successful.
[0146] In a possible implementation, the processing unit 502 is specifically used to: obtain the ID of the wallet in the payment device, and obtain the corresponding identity credential information according to the ID of the wallet; perform hash operations on each time period and the identity credential information to obtain a one-time password set.
[0147] In a 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; decrypt the ciphertext information in the offline payment code based on the process key to obtain a one-time password and a wallet ID.
[0148] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0149] Fig. 9 FIG. 1 is a block diagram of an electronic device according to an exemplary embodiment. Fig. 9 As shown, the electronic device 60 includes but is not limited to: a processor 601 and a memory 602 .
[0150] The memory 602 is used to store executable instructions of the processor 601. It can be understood that the processor 601 is configured to execute instructions to implement the offline payment method in the above embodiment.
[0151] It should be noted that those skilled in the art can understand that Fig. 9 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and the electronic device may include Fig. 9 More or fewer components may be shown, or certain components may be combined, or the components may be arranged differently.
[0152] The processor 601 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 602, and calling data stored in the memory 602, it performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. The processor 601 may include one or more processing units; optionally, the processor 601 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may also be integrated into the processor 601.
[0153] The memory 602 may be used to store software programs and various data. The memory 602 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one functional module, etc. In addition, the memory 602 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0154] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 602 including instructions, and the above instructions can be executed by a processor 601 of an electronic device 60 to implement the offline payment method in the above embodiment.
[0155] In actual implementation, Figure 7 The processing functions of the acquisition unit 401, the processing unit 402 and the generation unit 403 in Fig. 9 The processor 601 in the embodiment calls the computer program stored in the memory 602. The specific execution process can refer to the description of the offline payment method in the above embodiment, which will not be repeated here.
[0156] in addition, Figure 8 The processing functions of the receiving unit 501 and the processing unit 502 in Fig. 9 The processor 601 in the embodiment calls the computer program stored in the memory 602. The specific execution process can refer to the description of the offline payment method in the above embodiment, which will not be repeated here.
[0157] Optionally, the computer-readable storage medium may be a non-temporary computer-readable storage medium, for example, the non-temporary computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0158] In an exemplary embodiment, the present 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 embodiment.
[0159] It should be noted that when the instructions in the above-mentioned computer-readable storage medium or one or more instructions in the computer program product are executed by the processor 601 of the electronic device 60, the various processes of the above-mentioned offline payment method embodiment are implemented, and the same technical effect as the above-mentioned offline payment method can be achieved. To avoid repetition, they will not be repeated here.
[0160] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned 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 the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0162] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0163] In addition, each functional unit in each embodiment of the present application may be integrated into one processor, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0164] If the integrated unit is implemented in the form of 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 embodiment of the present application is essentially or the part that contributes to the prior art or the full classification part or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including a number of instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute the full classification part or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, ROM, RAM, disk or CD and other media that can store program code.
[0165] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto, and any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. An offline payment method, characterized in that: 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 encryption information; The encrypted information includes an agreed key; the method includes: When the payment device is off-grid, in response to a payment request operation by a user, obtaining the identity credential information and the encryption information in the security element, and determining a transaction timestamp and a transaction time period according to a current timestamp; Performing a hash operation on the transaction time period and the identity credential information to obtain a one-time password; Generate ciphertext information according to the agreed secret key, the one-time password, the ID of the wallet, and the transaction timestamp, and generate an offline payment code according to the ciphertext information; the offline payment code is used to be displayed to the payment receiving device, so that the payment receiving device verifies the offline payment code through the server of the wallet, and conducts digital currency transactions when the verification is passed.
2. The offline payment method according to claim 1, characterized in that: The payment device is a payment terminal or a hardware wallet; In the case where the payment device is the payment terminal, the payment terminal is installed with payment software, and in the case where the payment device is off-network, in response to a payment request operation of a user, obtaining the identity credential information and the encryption information in the security element includes: in the case where the payment terminal is off-network, in response to a payment request operation performed by a user through the payment software, obtaining the identity credential information and the encryption information in the security element; In the case where the payment device is the hardware wallet, the hardware wallet is provided with a payment request button, and when the payment device is off-grid, in response to a payment request operation of a user, obtaining the identity credential information and the encryption information in the security element, includes: when the hardware wallet is off-grid, in response to a payment request operation generated by the user through 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 also includes: when the payment device is connected to the Internet, receiving the payment information sent by the server.
4. The offline payment method according to claim 1, characterized in that: The generating of ciphertext information according to the agreed key, the one-time password, the wallet ID, and the transaction timestamp includes: Determine a process key according to the agreed key and the temporary random number; The one-time password, the wallet ID, and the transaction timestamp are encrypted according to the process key to obtain the ciphertext information.
5. The offline payment method according to claim 2, characterized in that: The method further comprises: When the payment terminal is connected to the network and successfully logs into the payment software, receiving 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 claim 2, characterized in that: The method further comprises: When the hardware wallet is connected to the Internet and the user activates the hardware wallet, receiving 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.
7. The offline payment method according to claim 5, characterized in that: The encrypted information includes a public key certificate, and the identity credential information is the identity credential information encrypted by the server; when the payment terminal is connected to the network and the payment terminal successfully logs into the payment software, receiving the identity credential information and the encrypted information sent by the server of the payment software, and storing the identity credential information and the encrypted information in the security element, comprises: receiving the encrypted identity credential information and the 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; The public key certificate in the encrypted information is signature-verified, and if the signature is verified, the encrypted identity credential information and the encrypted information are stored in the security element.
8. The offline payment method according to any one of claims 2 to 7, characterized in that: The method further comprises: In the case where the payment device is off-network, in response to the payment request operation of the user, determining the current offline transaction number of the user; When 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 through networking.
9. The offline payment method according to claim 8, characterized in that: After generating the reminder information, the method further includes: When the hardware wallet is converted from off-grid to online, the identity credential information is updated and the current number of offline transactions is reset.
10. The offline payment method according to claim 8, characterized in that: After generating the reminder information, the method further includes: When the payment terminal is converted from off-network to online and the payment terminal successfully logs into the payment software again, the identity credential information is updated and the current number of offline transactions is reset.
11. The offline payment method according to claim 1, characterized in that: The security element also stores the user's payment password; the ciphertext information is generated according to the agreed secret key, the one-time password, the wallet ID, and the current timestamp, including: When the current payment amount of the payment device is greater than the preset password-free payment amount of the user, the ciphertext information is generated according to the agreed secret key, the one-time password, the ID of the wallet, the current timestamp and the payment password.
12. An offline payment method, characterized in that: Applied to a server, the server is used to provide payment services for a payment device including a wallet; the method comprises: In the case where the payment device is off-network, receiving an offline payment code of the payment device forwarded by a payment receiving device; the offline payment code is generated by the payment device based on the agreed key and identity credential information in the encrypted information; The offline payment code is verified according to the agreed key, and if the verification passes, the digital currency transaction between the payment device and the payment device is allowed.
13. The offline payment method according to claim 12, characterized in that: In the case where the verification is passed, the payment device and the payment receiving device are allowed to conduct digital currency transactions, including: If the verification is successful, the digital currency in the wallet of the payment device is transferred to the wallet of the payment device.
14. The offline payment method according to claim 12, characterized in that: The method further comprises: When the payment device is connected to the network, the identity credential information and the encrypted information are sent to the payment device.
15. The offline payment method according to claim 14, characterized in that: The encrypted information includes a public key certificate; and when the payment device is connected to a network, sending the identity credential information and the encrypted information to the payment device includes: When the payment device is connected to the network, the identity credential information is encrypted, and the encrypted identity credential information and encrypted information including a public key certificate are sent to the payment device.
16. The offline payment method according to claim 12, characterized in that: The offline payment code is generated by the payment device based on the ciphertext information, the ciphertext information is generated by the payment device according to the agreed secret key, the one-time password, the wallet ID, and the transaction timestamp, and the one-time password is obtained by the payment device performing a hash operation on the transaction time period and the identity credential information; The verifying the offline payment code according to the agreed key includes: Decrypt the offline payment code according to the agreed key to obtain the one-time password and wallet ID; Determine a timestamp before the transaction timestamp and a timestamp after the transaction timestamp to obtain multiple timestamps; Generate a one-time password set based on the time periods corresponding to the multiple timestamps and the ID of the wallet; The one-time password is compared with the one-time passwords in the one-time password set. If there is a one-time password in the one-time password set that is the same as the one-time password, the verification is successful.
17. The offline payment method according to claim 16, characterized in that: The generating a one-time password set based on each time period corresponding to the multiple timestamps and the ID of the wallet includes: Obtaining the ID of the wallet in the payment device, and obtaining the corresponding identity credential information according to the ID of the wallet; A hash operation is performed on the time periods and the identity credential information to obtain the one-time password set.
18. The offline payment method according to claim 16, characterized in that: Decrypting the offline payment code according to the agreed key to obtain the one-time password and the 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; According to the process key, the ciphertext information in the offline payment code is decrypted to obtain the one-time password and the wallet ID.
19. A payment system, characterized in that: The payment system includes a payment device, a payment 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 encryption information; the encryption information includes an agreed key; The payment device is used to obtain the identity credential information and the encryption information in the security element in response to a payment request operation of a user when the payment device is off-grid, and determine a transaction timestamp and a transaction time period according to a current timestamp; The payment device is further used to perform a hash operation on the transaction time period and the identity credential information to obtain a one-time password, and generate ciphertext information according to the agreed secret key, the one-time password, the ID of the wallet, and the transaction timestamp, and generate an offline payment code according to the ciphertext information; the offline payment code is used to display it to the payment receiving device, so that the payment receiving device verifies the offline payment code through the server of the wallet, and performs a digital currency transaction if the verification is passed; The payment receiving device is used to obtain the offline payment code and send the offline payment code to the server; The server is used to receive the offline payment code of the payment device forwarded by the payment receiving device when the payment device is off-network, verify the offline payment code according to the agreed key, and agree to the digital currency transaction between the payment device and the payment receiving device if the verification is successful.
20. A payment device, characterized in that: Applied to a payment device, the payment device includes a wallet, the wallet includes a security element, the security element stores identity credential information and encryption information; the encryption 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 payment request operation of a user, acquire the identity credential information and the encryption information in the security element when the payment device is off-grid, and determine a transaction timestamp and a transaction time period according to a 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 generating unit is used to generate ciphertext information according to the agreed secret key, the one-time password, the wallet ID, and the transaction timestamp, and generate an offline payment code according to the ciphertext information; The offline payment code is used to be displayed to the payment receiving device, so that the payment receiving device verifies the offline payment code through the server of the wallet, and performs digital currency transactions when the verification is passed.
21. A payment device, characterized in that: Applied to a server, the server is used to provide payment services for a payment device including a wallet; the device includes a receiving unit and a processing unit; The receiving unit is used to receive the offline payment code of the payment device forwarded by the payment receiving device when the payment device is off-network; The offline payment code is generated by the payment device based on the agreed key and identity credential information in the encrypted 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 digital currency transaction between the payment device and the payment device.
22. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the offline payment method performed by the payment device or the server as described in any one of claims 1-18.
23. A computer-readable storage medium, characterized in that: When the computer-executable instructions stored in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can execute the offline payment method executed by the payment device or the server as described in any one of claims 1 to 18.
Citation Information
Patent Citations
Offline payment method, terminal device, backend payment apparatus and offline payment system
CN105931047A
Off-line payment method and system based on TOTP algorithm
CN107818463A
Mobile offline payment method and mobile offline payment system
CN110163598A
Currency collection method, currency collection device and readable storage medium
CN112712359A
Off-line payment method and system, payment terminal and collection terminal
CN113129005A
Cited By
Payment method and device, equipment and medium
CN122415087A
