The invention discloses an off-line payment method and system based on a TOTP (Time-based One-time Password) algorithm, and belongs to the technical field of computers. The off-line payment method andsystem based on a TOTP algorithm includes the steps: a client generates a dynamic verification code according to the self-stored payment key, the unique equipment identifier of the equipment and thefirst current time every preset time interval, takes the dynamic verification code as the current dynamic verification code, generates an off-line payment code according to the current dynamic verification code, the user identifier and the shared key, and sends the off-line payment code to a first server through a merchant; the first server derives the user identifier according to the off-line payment code and the shared key, and acquires the corresponding payment key, the unique equipment identifier and the account identifier according to the user identifier, and verifies whether the off-linepayment code is correct according to the second current time, the obtained payment key and the obtained unique equipment identifier; if the off-line payment code is correct, according to the accountidentifier, payment is completed through a payment platform and payment success information is returned to the client and the merchant, and over; and if the off-line payment code is not correct, payment failure information is returned to the client and the merchant, and over.