A method, device and storage medium for generating transaction code

By generating a preset sequence that meets specific characteristics in UnionPay transactions and adding it to the transaction code, the security problem caused by the random value of the QR code generation sequence is solved, and the randomness of the transaction code and payment security are improved.

CN110322237BActive Publication Date: 2024-08-27PING AN BANK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910431890.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-05-23
Publication Date
2024-08-27
Estimated Expiration
2039-05-23

AI Technical Summary

Technical Problem

In existing UnionPay transactions, the random value generation method of QR codes results in similar code values, which are easily imitated or altered, resulting in low security for online payments.

Method used

By generating a preset sequence, setting its length according to business needs or region, and adding it to the transaction code, it ensures that the growth rate of the sequence reflects changes in transaction volume or is non-repetitive, and improves the randomness and uniqueness of the transaction code.

Benefits of technology

The generated transaction code is highly random and difficult to crack, imitate or tamper with, significantly improving payment security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110322237B
    Figure CN110322237B
Patent Text Reader

Abstract

The present application relates to the field of transaction verification, and provides a method, device and storage medium for generating a transaction code, the method comprising: receiving a payment request sent by a terminal device; after the identity authentication of the terminal device is passed, generating a preset sequence, the length of the preset sequence is fixed or can be adjusted dynamically, and the length of the preset sequence is set according to business needs or the area where the merchant terminal is located; adding the preset sequence to the transaction code string to obtain the transaction code; sending the transaction code to the terminal device; the preset sequence meets one of the following characteristics: the growth rate of the preset sequence reflects the development status of UnionPay transactions within a period of time, the growth rate increases with the increase of the total transaction volume counted at the hour, the growth rate is the dependent variable, and the total transaction volume counted at the hour is the independent variable; the preset sequence does not recur in different transaction cycles; or, the preset sequence does not recur in the same transaction cycle. The adoption of this scheme can improve the randomness of the transaction code, and the resistance to cracking, imitation or tampering.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of transaction verification, and in particular to a method, device and storage medium for generating a transaction code. Background Art

[0002] In current UnionPay transactions, consumers generally send payment requests to the consumer management center through the application (APP) on their mobile phones. The payment management sends the payment request to the payment management center through the payment card information. After receiving the payment request, the payment management center authenticates the consumer. After the verification, it generates the corresponding QR code to the APP. The APP displays the received QR code for the owner of the merchant terminal to scan, and then transmits the scanned QR code to the payment system for payment authorization.

[0003] Due to the huge number of concurrent UnionPay transactions in online payments, lower UnionPay transaction time is required. Since the QR code is currently generated in a local area by random sampling, the similarity of the QR codes generated in this way is getting higher and higher within microseconds under the premise of lower time consumption, which can easily lead to similar code values ​​and be easily imitated or tampered, resulting in low security of online payments. Summary of the invention

[0004] The present application provides a method, device and storage medium for generating a transaction code, which can solve the problem of low payment security in the prior art.

[0005] In a first aspect, the present application provides a method for generating a transaction code, the method comprising:

[0006] Receiving a payment request sent by a terminal device;

[0007] After the identity authentication of the terminal device is passed, a preset sequence is generated, wherein the length of the preset sequence is fixed or dynamically adjustable, and the length of the preset sequence is set accordingly according to business requirements or the area where the merchant terminal is located;

[0008] Adding the preset sequence to the transaction code string to obtain a transaction code;

[0009] sending the transaction code to the terminal device;

[0010] The preset sequence satisfies at least one of the following characteristics:

[0011] The growth rate of the preset sequence reflects the development status of UnionPay transactions within a period of time. The growth rate increases as the total transaction volume counted at the hour increases. The growth rate is the dependent variable, and the total transaction volume counted at the hour is the independent variable.

[0012] Alternatively, the preset sequence does not recur in different transaction cycles;

[0013] Alternatively, the preset sequence does not recur in the same transaction cycle.

[0014] In a possible design, generating a preset sequence includes at least one of the following implementations:

[0015] A preset sequence of a first length is set for merchant terminals in a first region, and a preset sequence of a second length is set for merchant terminals in a second region, wherein the first length and the second length are not equal;

[0016] Alternatively, a preset sequence matching the number of digits in the area code is set according to the area code of the area where the merchant device is located;

[0017] Alternatively, the preset sequence is generated by changing the natural law, and the natural law includes at least one of exponential growth, linear growth, polynomial growth or nonlinear growth; the length of the preset sequence is obtained by using the formula S=FUN(S1);

[0018] Alternatively, a field of the preset sequence is used as a random position. When a transaction code needs to be generated, the change value of the random position is recalculated, and other positions in the preset sequence remain unchanged. The preset sequence includes a fixed field and a dynamic field. The dynamic field is a random position. The change value of the random position is calculated according to the formula C=RANDOM().

[0019] In one possible design, the method further includes:

[0020] When the business requirements change, the formula for calculating the change value of the random position is switched from C=RANDOM() to one of the following formulas to change the generation rule of the preset sequence matching the business requirements:

[0021] C = S [RANDOM()%STRLEN(S)]

[0022] C=FUN(S1[RANDOM()%STRLEN(S1)], S2[RANDOM()%STRLEN(S2)],…).

[0023] In a possible design, adding the preset sequence to the transaction code string includes:

[0024] Repeatedly taking the value of a random position of the sequence and adding it to the random position in the preset sequence until the values ​​of all positions of the preset sequence are added;

[0025] The repeated selection refers to the generation of a QR code for a transaction. Each time the selection is repeated, a character at a random position in a preset sequence is inserted into a random position in the transaction code string until the random position of the transaction code string is filled.

[0026] In a possible design, the repeatedly taking the value of a random position of the sequence and adding it to the random position in the preset sequence until the values ​​of all positions of the preset sequence are added include:

[0027] Selecting a random number or a random symbol from a random position of the preset sequence each time;

[0028] The random number or random symbol selected this time is added to the transaction code string until all random numbers or random symbols at all random positions in the preset sequence are added to the transaction code string.

[0029] In a possible design, the repeatedly taking the value of a random position of the sequence and adding it to the random position in the preset sequence until the values ​​of all positions of the preset sequence are added include:

[0030] Sequentially, the preset sequence to be added to the transaction code string is decomposed into a plurality of random single characters;

[0031] Each single character obtained by disassembling is randomly inserted into the initial transaction code string to obtain the transaction string code.

[0032] In one possible design, the method further includes:

[0033] constructing at least one first container and at least one second container;

[0034] An instance for generating the preset sequence is created in the first container, and an instance for generating the transaction code is created in the second container, so as to isolate a generation environment of the preset sequence from a generation environment of the transaction code.

[0035] In a second aspect, the present application provides a device for generating a transaction code, which has the function of implementing the method for generating a transaction code provided in the first aspect. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions, and the modules can be software and / or hardware.

[0036] In one possible design, the device includes:

[0037] A transceiver module, used for receiving a payment request sent by a terminal device;

[0038] A processing module, configured to generate a preset sequence after the identity authentication of the terminal device is passed, add the preset sequence to the transaction code string to obtain a transaction code; and send the transaction code to the terminal device through the transceiver module;

[0039] The length of the preset sequence is fixed or dynamically adjustable, and the length of the preset sequence is set accordingly according to business requirements or the region where the merchant terminal is located;

[0040] The preset sequence satisfies at least one of the following characteristics:

[0041] The growth rate of the preset sequence reflects the development status of UnionPay transactions within a period of time. The growth rate increases as the total transaction volume counted at the hour increases. The growth rate is the dependent variable, and the total transaction volume counted at the hour is the independent variable.

[0042] Alternatively, the preset sequence does not recur in different transaction cycles;

[0043] Alternatively, the preset sequence does not recur in the same transaction cycle.

[0044] In one possible design, the processing module performs at least one of the following operations to generate a preset sequence:

[0045] A preset sequence of a first length is set for merchant terminals in a first region, and a preset sequence of a second length is set for merchant terminals in a second region, wherein the first length and the second length are not equal;

[0046] Alternatively, a preset sequence matching the number of digits in the area code is set according to the area code of the area where the merchant device is located;

[0047] Alternatively, the preset sequence is generated by changing the natural law, and the natural law includes at least one of exponential growth, linear growth, polynomial growth or nonlinear growth; the length of the preset sequence is obtained by using the formula S=FUN(S1);

[0048] Alternatively, a field of the preset sequence is used as a random position. When a transaction code needs to be generated, the change value of the random position is recalculated, and other positions in the preset sequence remain unchanged. The preset sequence includes a fixed field and a dynamic field. The dynamic field is a random position. The change value of the random position is calculated according to the formula C=RANDOM().

[0049] In one possible design, the processing module is further used for:

[0050] When the business requirements change, the formula for calculating the change value of the random position is switched from C=RANDOM() to one of the following formulas to change the generation rule of the preset sequence matching the business requirements:

[0051] C = S [RANDOM()%STRLEN(S)]

[0052] C=FUN(S1[RANDOM()%STRLEN(S1)], S2[RANDOM()%STRLEN(S2)],…).

[0053] In a possible design, the processing module is specifically used for:

[0054] Repeatedly taking the value of a random position of the sequence and adding it to the random position in the preset sequence until the values ​​of all positions of the preset sequence are added;

[0055] The repeated selection refers to the generation of a QR code for a transaction. Each time the selection is repeated, a character at a random position in a preset sequence is inserted into a random position in the transaction code string until the random position of the transaction code string is filled.

[0056] In a possible design, the processing module is specifically used for:

[0057] Selecting a random number or a random symbol from a random position of the preset sequence each time;

[0058] The random number or random symbol selected this time is added to the transaction code string until all random numbers or random symbols at all random positions in the preset sequence are added to the transaction code string.

[0059] In a possible design, the processing module is specifically used for:

[0060] Sequentially, the preset sequence to be added to the transaction code string is decomposed into a plurality of random single characters;

[0061] Each single character obtained by disassembling is randomly inserted into the initial transaction code string to obtain the transaction string code.

[0062] In one possible design, the processing module is further used for:

[0063] constructing at least one first container and at least one second container;

[0064] An instance for generating the preset sequence is created in the first container, and an instance for generating the transaction code is created in the second container, so as to isolate a generation environment of the preset sequence from a generation environment of the transaction code.

[0065] On the other hand, the present application provides a computer device, which includes at least one connected processor, memory and transceiver, wherein the memory is used to store program code, and the processor is used to call the program code in the memory to execute the method described in the first aspect above.

[0066] On the other hand, the present application provides a computer storage medium, which includes instructions. When the instructions are executed on a computer, the computer executes the method described in the first aspect.

[0067] Compared with the prior art, the solution provided by the present application adds the preset sequence to the code value, repeatedly takes the value of the random position of the sequence and adds it to the random position of the code value until all the values ​​of the sequence are added, and finally obtains the transaction code. Since the sequence is shared by all transactions in the transaction system, its self-increment speed is not fixed, depends on the transaction volume at a certain point in time, and does not repeat within a cycle, the transaction code generated by the present application is highly random and not easy to be cracked, imitated or tampered with, thereby improving the security of the entire payment. BRIEF DESCRIPTION OF THE DRAWINGS

[0068] Figure 1 A flow chart of a method for generating a transaction code in an embodiment of the present application;

[0069] Figure 2 A schematic diagram of a random sequence in an embodiment of the present application;

[0070] Figure 3 A schematic diagram of a random sequence in an embodiment of the present application;

[0071] Figure 4 A schematic diagram of a random sequence in an embodiment of the present application;

[0072] Figure 5 A schematic diagram of a random sequence in an embodiment of the present application;

[0073] Figure 6 A schematic diagram of the structure of a device for generating a transaction code in an embodiment of the present application;

[0074] Figure 7 A schematic diagram of the structure of a computer device in an embodiment of the present application.

[0075] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0076] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application. 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 interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than the content illustrated or described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device including a series of steps or modules is not necessarily limited to those steps or modules clearly listed, but may include other steps or modules that are not clearly listed or inherent to these processes, methods, products or devices. The division of the modules that appear in the present application is only a logical division, and there may be other division methods when implemented in practical applications, for example, multiple modules can be combined into or integrated in another system, or some features can be ignored or not executed.

[0077] The present application provides a method, device and storage medium for generating a transaction code, which can be used for UnionPay transactions.

[0078] In order to solve the above technical problems, this application mainly provides the following technical solutions:

[0079] By adding a fixed-length sequence to the code value, the value of the random position of the sequence is repeatedly added to the random position of the code value until all the values ​​of the sequence are added. Since the sequence is shared by all transactions in the transaction system, its self-increment speed is not fixed, depends on the transaction volume at a certain point in time, and does not repeat within a cycle. Therefore, the randomness of the QR code generated by this application is very high, and it is not easy to be cracked, imitated or tampered with, thereby improving the security of the entire payment.

[0080] Please refer to Figure 1 The following is an example of a method for generating a transaction code provided by the present application, the method comprising:

[0081] 101. Receive a payment request sent by a terminal device.

[0082] The payment request includes the transaction number, transaction account, transaction commodity name and transaction amount. For example, a user buys a 20-yuan juice in a beverage store. After the user scans the merchant's payment code with a mobile phone and selects a third-party payment platform, the mobile phone sends a payment request to the third-party payment platform to pay 20 yuan to the beverage store.

[0083] 102. After the identity authentication of the terminal device is passed, a preset sequence is generated.

[0084] The length of the preset sequence is fixed or dynamically adjustable, and the length of the preset sequence is set accordingly according to business requirements or the area where the merchant terminal is located.

[0085] In some implementations, the preset sequence in the present application satisfies at least one of the following characteristics:

[0086] (1) The growth rate of the preset sequence reflects the development status of UnionPay transactions within a period of time. The growth rate increases with the increase of the total number of transactions counted at the hour. The growth rate is the dependent variable, and the total number of transactions counted at the hour is the independent variable. For example, the length of the preset sequence is 9 digits. The total number of transactions at 10 a.m. is 1 million, and the growth rate is 27 transactions per second; the total number of transactions at 12 noon is 4 million, and the growth rate is 416 transactions per second; the total number of transactions at 15 p.m. is 32 million, and the growth rate is 2592 transactions per second.

[0087] (2) The preset sequence does not recur in different trading cycles. For example, at 12:00 on the first day, the preset sequence is 10001011. At 12:00 on the second day or at other trading time points, the preset sequence will not be 10001011, but may be 10001011 or 10101011.

[0088] (3) The preset sequence does not recur in the same trading cycle. For example, at 9:00 on the first day, the preset sequence is 10001011. At 13:00 on the first day or at other trading time points, the preset sequence will not be 10001011, but may be 10001011 or 10101011.

[0089] It can be seen that by setting the preset sequence to be non-reproducible, the transaction code's anti-cracking ability can be effectively improved, and its changing pattern is not easy to be cracked, so it has higher security.

[0090] In some implementations, the generation rule of the preset sequence includes at least one of the following implementations:

[0091] (1) A preset sequence of a first length is set for merchant terminals in a first region, and a preset sequence of a second length is set for merchant terminals in a second region, wherein the first length and the second length are not equal.

[0092] (2) A preset sequence matching the number of digits in the area code is set according to the area code where the merchant device is located.

[0093] For example, the length of the preset sequence used by merchant terminals in Guangzhou and Shenzhen is different. The area code of Guangzhou is one digit less than that of Shenzhen. This also makes it easier for the payment system to generate QR codes regularly within a certain period of time and facilitates the backend management of the QR codes.

[0094] (3) The preset sequence is generated by changing the natural law, and the natural law includes at least one of exponential growth, linear growth, polynomial growth or nonlinear growth; the length of the preset sequence is obtained by using formula 1 S=FUN(S1).

[0095] (4) Since the number of transactions occurring at each moment is large and the transactions occur at irregular times, in order to facilitate the management of the preset sequence and facilitate the regular and efficient generation of preset sequences with different values ​​and the same length by the background, a field of the preset sequence can also be used as a random position, and when a transaction code needs to be generated, the change value of the random position is recalculated.

[0096] Wherein, other positions in the preset sequence are fixed and unchanged, and the preset sequence includes fixed fields and dynamic fields, and the dynamic fields are random positions. When recalculating the change value of the random position, the change value of the random position can be calculated according to the formula 2 C=RANDOM(), without constantly switching the calculation formula according to the change of the number of bits of the random position.

[0097] The present application does not limit the number and form of expression of Formula 1, as long as it can realize the calculation of the length of the preset sequence in the present application. The present application does not limit the number and form of expression of Formula 2, as long as it can realize the calculation of the random position in the present application.

[0098] Specifically, this application does not limit the setting method of the length of the preset sequence and the generation rule of the preset sequence.

[0099] 103. Add the preset sequence to the transaction code string to obtain a transaction code.

[0100] The transaction code string may be a QR code string, and may be considered as an initial string for generating a transaction code.

[0101] The transaction code refers to a transaction authentication method that uses mobile phone text messages to verify transactions during online banking and mobile banking. The transaction code includes information such as the consumer identity and the preset sequence. The random numbers in the transaction code are used to verify the authenticity of the transaction code. For example, after a user places an order, the payment interface is redirected, and a QR code is generated on the payment interface. This QR code is the transaction code generated by the payment system in the background.

[0102] In some implementations, adding the preset sequence to the transaction code string includes:

[0103] Repeatedly take the value of a random position in the sequence and add it to the random position in the preset sequence until the values ​​of all positions in the preset sequence are added. The repeated selection refers to the generation of a QR code for a transaction. Each time the selection is repeated, a character at a random position in the preset sequence is inserted into a random position in the transaction code string until the random position of the transaction code string is filled.

[0104] 104. Send the transaction code to the terminal device.

[0105] After the user shows the terminal device to the merchant terminal, the merchant terminal obtains the transaction code by scanning the consumer's terminal device, and then enters the code into the payment system to obtain the consumer's payment amount, thereby completing the transaction payment.

[0106] Compared with the existing mechanism, in the embodiment of the present application, by adding the preset sequence to the code value, repeatedly taking the value of the random position of the sequence and adding it to the random position of the code value until all the values ​​of the sequence are added, the transaction code is finally obtained. Since the sequence is shared by all transactions in the transaction system, its self-increment speed is not fixed, depends on the transaction volume at a certain point in time, and does not repeat within a cycle, the transaction code generated by the present application is highly random and not easy to be cracked, imitated or tampered with, thereby improving the security of the entire payment.

[0107] Optionally, in some embodiments of the present application, when the business requirements change, the formula for calculating the change value of the random position is switched from C=RANDOM() to one of the following formulas to change the generation rule of the preset sequence matching the business requirements:

[0108] C = S [RANDOM()%STRLEN(S)]

[0109] C=FUN(S1[RANDOM()%STRLEN(S1)], S2[RANDOM()%STRLEN(S2)],…).

[0110] Optionally, in some embodiments of the present application, the repeatedly taking the value of the random position of the sequence is added to the random position in the preset sequence until the values ​​of all positions of the preset sequence are added, including one of the following two methods:

[0111] Method 1:

[0112] Each time a random number or random symbol is selected from a random position in the preset sequence, the selected random number or random symbol is added to the transaction code string until all random numbers or random symbols at all random positions in the preset sequence are added to the transaction code string.

[0113] Method 2:

[0114] The preset sequence to be added to the transaction code string is decomposed into a plurality of random single characters in order, and each single character obtained by the decomposition is randomly inserted into the initial transaction code string to obtain the transaction code string.

[0115] Optionally, in some embodiments of the present application, since the preset sequence of the present application is generated based on other systems (databases) and is not in the generation system of the transaction code (such as a QR code), the generation environment of the preset sequence can be isolated from the generation environment of the transaction code. The isolation method can be implemented by using a container, that is, setting container 1 and container 2, creating an instance of generating the preset sequence in container 1, and creating an instance of generating the transaction code in container 2. Specifically, the method also includes:

[0116] constructing at least one first container and at least one second container;

[0117] An instance for generating the preset sequence is created in the first container, and an instance for generating the transaction code is created in the second container, so as to isolate a generation environment of the preset sequence from a generation environment of the transaction code.

[0118] It can be seen that, on the one hand, the method of generating transaction codes by isolating two containers in the present application can ensure that the generated transaction code string is less likely to be imitated or tampered with than the initial transaction code string.

[0119] On the other hand, when the preset sequence is inserted into the original transaction code string, the preset sequence is subjected to double random processing (ie, the above-mentioned method 1 and method 2), so that the character sequence and value of the transaction code string can be made more complex and not easy to be imitated.

[0120] For ease of understanding, the following uses a QR code as an example to illustrate the process of generating a transaction code:

[0121] The sequence for generating a QR code is as follows:

[0122] 1. Generate a basic QR code string, perform basic duplication check during this process, and ensure that consecutive characters are not repeated.

[0123] 2. Generate a preset sequence.

[0124] 3. Then get a single character in the preset sequence.

[0125] 4. Insert the obtained characters into random positions of the basic QR code string.

[0126] 5. Update the QR code string.

[0127] 6. Update the preset sequence.

[0128] 7. Repeat steps 1 to 6 until all characters in the preset sequence are inserted into the QR code string, and finally a new QR code string is obtained.

[0129] For example, after a preset sequence of characters is inserted into the initial two-dimensional code string, the positions of the characters in the corresponding initial two-dimensional code string change accordingly, as follows:

[0130] Initial QR code string: 19BT67D

[0131] Default sequence: 456321

[0132] Insert '2' in the preset sequence into the third position in the positive sequence of the initial two-dimensional code string, then the initial two-dimensional code string becomes: 192BT67D, and the preset sequence becomes: 45631. Set each character in the preset sequence to be non-repeated until each character in the preset sequence is completely inserted into the initial two-dimensional code string.

[0133] Optionally, in some embodiments of the present application, the random position in the preset sequence is a field with continuous or discontinuous bits. Figure 2 As shown, Figure 2 a means that the random position is a preset sequence of consecutive bits. Figure 2 The b in the figure indicates that the random positions are preset sequences of bit breaks.

[0134] If the transaction rules or business requirements change and the generation rules of the preset sequence need to be updated accordingly, the position and length of the random position in the preset sequence can also be adjusted. Figure 3 A structural schematic diagram of a preset sequence before the generation rule of the preset sequence is updated is shown, the number of bits occupied by the random position is 4, and the field occupied by the random position is from bit 4 to bit 7.

[0135] When update is needed Figure 3 After the generation rule of the preset sequence shown in FIG. 1 is followed, for example, the field occupied by the random position is updated from position 4 to position 7 to position 5 to position 8. The updated preset sequence is as follows: Figure 4 shown.

[0136] Or, when an update is required Figure 3 After the generation rule of the preset sequence shown in FIG. 1 is followed, the field occupied by the random position is updated from bit 4 to bit 7 to bit 2, and from bit 5 to bit 7. The updated preset sequence is as follows: Figure 5 shown.

[0137] Above Figure 1-Figure 5 The technical features mentioned in any embodiment or implementation are also applicable to the present application. Figure 6 and Figure 7 The corresponding embodiments will not be described in detail later.

[0138] A method for generating a transaction code in the present application is described above, and a device for executing the method for generating a transaction code is described below.

[0139] like Figure 6 The schematic diagram of the structure of a device 60 for generating a two-dimensional code is shown in FIG. 6 , which can be applied to UnionPay transactions. The device 60 in the embodiment of the present application can achieve the corresponding Figure 1-Figure 5 The steps of the method for generating a transaction code executed in any embodiment or implementation of the invention. The functions implemented by the device 60 can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions, and the modules can be software and / or hardware. The device 60 may include a transceiver module 601 and a processing module 602. The functions of the processing module 602 and the transceiver module 601 can be implemented by reference to Figure 1-Figure 5 The operations performed in any embodiment or implementation are not described in detail here. The processing module 602 can be used to control the transceiver operation of the transceiver module 601.

[0140] In some implementations, the transceiver module 601 may be used to receive a payment request sent by a terminal device;

[0141] The processing module 602 may be used to generate a preset sequence after the identity authentication of the terminal device is passed, add the preset sequence to the transaction code string, and obtain a transaction code; and send the transaction code to the terminal device through the transceiver module 601;

[0142] The length of the preset sequence is fixed or dynamically adjustable, and the length of the preset sequence is set accordingly according to business requirements or the region where the merchant terminal is located;

[0143] The preset sequence satisfies at least one of the following characteristics:

[0144] The growth rate of the preset sequence reflects the development status of UnionPay transactions within a period of time. The growth rate increases as the total transaction volume counted at the hour increases. The growth rate is the dependent variable, and the total transaction volume counted at the hour is the independent variable.

[0145] Alternatively, the preset sequence does not recur in different transaction cycles;

[0146] Alternatively, the preset sequence does not recur in the same transaction cycle.

[0147] In the embodiment of the present application, the processing module 602 adds the preset sequence to the code value, repeatedly takes the value of the random position of the sequence and adds it to the random position of the code value until all the values ​​of the sequence are added, and finally obtains the transaction code. Since the sequence is shared by all transactions in the transaction system, its self-increment speed is not fixed, depends on the transaction volume at a certain point in time, and does not repeat within a cycle, the transaction code generated by the present application is highly random and not easy to be cracked, imitated or tampered with, thereby improving the security of the entire payment.

[0148] In some implementations, the processing module 602 performs at least one of the following operations to generate a preset sequence:

[0149] A preset sequence of a first length is set for merchant terminals in a first region, and a preset sequence of a second length is set for merchant terminals in a second region, wherein the first length and the second length are not equal;

[0150] Alternatively, a preset sequence matching the number of digits in the area code is set according to the area code of the area where the merchant device is located;

[0151] Alternatively, the preset sequence is generated by changing the natural law, and the natural law includes at least one of exponential growth, linear growth, polynomial growth or nonlinear growth; the length of the preset sequence is obtained by using the formula S=FUN(S1);

[0152] Alternatively, a field of the preset sequence is used as a random position. When a transaction code needs to be generated, the change value of the random position is recalculated, and other positions in the preset sequence remain unchanged. The preset sequence includes a fixed field and a dynamic field. The dynamic field is a random position. The change value of the random position is calculated according to the formula C=RANDOM().

[0153] In some implementations, the processing module 602 is further configured to:

[0154] When the business requirements change, the formula for calculating the change value of the random position is switched from C=RANDOM() to one of the following formulas to change the generation rule of the preset sequence matching the business requirements:

[0155] C = S [RANDOM()%STRLEN(S)]

[0156] C=FUN(S1[RANDOM()%STRLEN(S1)], S2[RANDOM()%STRLEN(S2)],…).

[0157] In some implementations, the processing module 602 is specifically configured to:

[0158] Repeatedly taking the value of a random position of the sequence and adding it to the random position in the preset sequence until the values ​​of all positions of the preset sequence are added;

[0159] The repeated selection refers to the generation of a QR code for a transaction. Each time the selection is repeated, a character at a random position in a preset sequence is inserted into a random position in the transaction code string until the random position of the transaction code string is filled.

[0160] In some implementations, the processing module 602 is specifically configured to:

[0161] Selecting a random number or a random symbol from a random position of the preset sequence each time;

[0162] The random number or random symbol selected this time is added to the transaction code string until all random numbers or random symbols at all random positions in the preset sequence are added to the transaction code string.

[0163] In some implementations, the processing module 602 is specifically configured to:

[0164] Sequentially, the preset sequence to be added to the transaction code string is decomposed into a plurality of random single characters;

[0165] Each single character obtained by disassembling is randomly inserted into the initial transaction code string to obtain the transaction string code.

[0166] In some implementations, the processing module 602 is further configured to:

[0167] constructing at least one first container and at least one second container;

[0168] An instance for generating the preset sequence is created in the first container, and an instance for generating the transaction code is created in the second container, so as to isolate a generation environment of the preset sequence from a generation environment of the transaction code.

[0169] The above describes the device 60 in the embodiment of the present application from the perspective of modular functional entities. The following describes a computer device from the perspective of hardware, such as Figure 7 As shown, it includes: a processor, a memory, a transceiver (it can also be an input and output unit, Figure 7 (not shown) and a computer program stored in the memory and executable on the processor. For example, the computer program may be Figure 1-Figure 5 A program corresponding to the method for generating a transaction code in any embodiment or implementation of the present invention. For example, when a computer device implements the method Figure 6 When the function of the device 60 shown in FIG. 6 is realized, the processor executes the computer program to realize the above Figure 6The steps of the method for generating a transaction code executed by the device 60 in the corresponding embodiment; or the processor implements the above when executing the computer program Figure 6 The functions of each module in the device 60 of the corresponding embodiment. For another example, the computer program can be Figure 1-Figure 5 A program corresponding to the method for generating a transaction code in any embodiment or implementation manner.

[0170] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the computer device, and uses various interfaces and lines to connect various parts of the entire computer device.

[0171] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the computer device by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, video data, etc.), etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0172] The transceiver may also be replaced by a receiver and a transmitter, and may be the same or different physical entities. When they are the same physical entities, they may be collectively referred to as transceivers. The transceiver may be an input-output unit.

[0173] The memory may be integrated into the processor or may be arranged separately from the processor.

[0174] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM) and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0175] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the inspiration of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims. All equivalent structures or equivalent process changes made using the contents of the specification and drawings of this application, or directly or indirectly used in other related technical fields, are protected by the present application.

Claims

1. A method for generating a transaction code, characterized in that: The method comprises: Receiving a payment request sent by a terminal device, wherein the payment request includes a transaction number, a transaction account, a transaction commodity name, and a transaction amount; After the identity authentication of the terminal device is passed, a preset sequence is generated, wherein the length of the preset sequence is fixed or dynamically adjustable, and the length of the preset sequence is set accordingly according to business requirements or the area where the merchant terminal is located; Generating a preset sequence includes at least one of the following implementations: A preset sequence of a first length is set for merchant terminals in a first region, and a preset sequence of a second length is set for merchant terminals in a second region, wherein the first length and the second length are not equal; Alternatively, a preset sequence matching the number of digits in the area code is set according to the area code of the area where the merchant device is located; Alternatively, the preset sequence is generated by changing the natural law, and the natural law includes at least one of exponential growth, linear growth, polynomial growth or nonlinear growth; the length of the preset sequence is obtained by using the formula S=FUN(S1); Alternatively, a field of the preset sequence is used as a random position, and when a transaction code needs to be generated, the change value of the random position is recalculated, and other positions in the preset sequence remain unchanged. The preset sequence includes a fixed field and a dynamic field, and the dynamic field is a random position. The change value of the random position is calculated according to the formula C=RANDOM(), and the random position in the preset sequence is a field with continuous or discontinuous bits; Adding the preset sequence to the transaction code string to obtain a transaction code; sending the transaction code to the terminal device; The preset sequence satisfies at least one of the following characteristics: The growth rate of the preset sequence reflects the development status of UnionPay transactions within a period of time. The growth rate increases as the total transaction volume counted at the hour increases. The growth rate is the dependent variable, and the total transaction volume counted at the hour is the independent variable. Alternatively, the preset sequence does not recur in different transaction cycles; Alternatively, the preset sequence does not recur in the same transaction cycle; When the business requirements change, the formula for calculating the change value of the random position is switched from C=RANDOM() to one of the following formulas to change the generation rule of the preset sequence matching the business requirements and adjust the position and occupied length of the random position in the preset sequence: C = S [RANDOM()%STRLEN(S)] C=FUN(S1[RANDOM()%STRLEN(S1)],S2[RANDOM()%STRLEN(S2)],…); constructing at least one first container and at least one second container; An instance for generating the preset sequence is created in the first container, and an instance for generating the transaction code is created in the second container, so as to isolate a generation environment of the preset sequence from a generation environment of the transaction code.

2. The method according to claim 1, characterized in that The step of adding the preset sequence to the transaction code string comprises: Repeatedly selecting a value at a random position of a preset sequence and adding it to a random position in the preset sequence until all values ​​at all positions of the preset sequence have been added; The repeated selection refers to the generation of a QR code for a transaction. Each time the selection is repeated, a character at a random position in a preset sequence is inserted into a random position in the transaction code string until the random position of the transaction code string is filled.

3. The method according to claim 2, characterized in that The repeatedly selecting a value at a random position of a preset sequence and adding it to a random position in the preset sequence until the values ​​of all positions of the preset sequence are added includes: Selecting a random number or a random symbol from a random position of the preset sequence each time; The random number or random symbol selected this time is added to the transaction code string until all random numbers or random symbols at all random positions in the preset sequence are added to the transaction code string.

4. The method according to claim 2, characterized in that: The repeatedly selecting a value at a random position of a preset sequence and adding it to a random position in the preset sequence until the values ​​of all positions of the preset sequence are added includes: Sequentially, the preset sequence to be added to the transaction code string is decomposed into a plurality of random single characters; The individual characters obtained by the disassembly are randomly inserted into the initial transaction code string to obtain the transaction code.

5. A device for generating a transaction code, characterized in that: The device comprises: The transceiver module is used to receive a payment request sent by a terminal device, wherein the payment request includes a transaction number, a transaction account, a transaction commodity name, and a transaction amount; A processing module, configured to generate a preset sequence after the identity authentication of the terminal device is passed, add the preset sequence to the transaction code string to obtain a transaction code; and send the transaction code to the terminal device through the transceiver module; Generating a preset sequence includes at least one of the following implementations: A preset sequence of a first length is set for merchant terminals in a first region, and a preset sequence of a second length is set for merchant terminals in a second region, wherein the first length and the second length are not equal; Alternatively, a preset sequence matching the number of digits in the area code is set according to the area code of the area where the merchant device is located; Alternatively, the preset sequence is generated by changing the natural law, and the natural law includes at least one of exponential growth, linear growth, polynomial growth or nonlinear growth; the length of the preset sequence is obtained by using the formula S=FUN(S1); Alternatively, a field of the preset sequence is used as a random position, and when a transaction code needs to be generated, the change value of the random position is recalculated, and other positions in the preset sequence remain unchanged. The preset sequence includes a fixed field and a dynamic field, and the dynamic field is a random position. The change value of the random position is calculated according to the formula C=RANDOM(), and the random position in the preset sequence is a field with continuous or discontinuous bits; The length of the preset sequence is fixed or dynamically adjustable, and the length of the preset sequence is set accordingly according to business requirements or the region where the merchant terminal is located; The preset sequence satisfies at least one of the following characteristics: The growth rate of the preset sequence reflects the development status of UnionPay transactions within a period of time. The growth rate increases as the total transaction volume counted at the hour increases. The growth rate is the dependent variable, and the total transaction volume counted at the hour is the independent variable. Alternatively, the preset sequence does not recur in different transaction cycles; Alternatively, the preset sequence does not recur in the same transaction cycle; When the business requirements change, the formula for calculating the change value of the random position is switched from C=RANDOM() to one of the following formulas to change the generation rule of the preset sequence matching the business requirements and adjust the position and occupied length of the random position in the preset sequence: C = S [RANDOM()%STRLEN(S)] C=FUN(S1[RANDOM()%STRLEN(S1)],S2[RANDOM()%STRLEN(S2)],…); constructing at least one first container and at least one second container; An instance for generating the preset sequence is created in the first container, and an instance for generating the transaction code is created in the second container, so as to isolate a generation environment of the preset sequence from a generation environment of the transaction code.

6. A computer device, characterized in that: The device comprises: at least one processor, memory, and transceiver; The memory is used to store program codes, and the processor is used to call the program codes stored in the memory to execute the method according to any one of claims 1 to 4.

7. A computer storage medium, characterized in that: The method comprises instructions which, when executed on a computer, cause the computer to execute the method according to any one of claims 1 to 4.