Live Demo Buy Now

OTP (One Time Password) for Magento 2

OTP (One Time Password) is a string of numeric or alphanumeric characters that generates automatically. And it is the most reliable authentication process.

With the help of this module, the admin can integrate OTP (One Time Password) verification feature on the Magento store. OTP verification can be used for the new customer while they are registering on the store and during the checkout process.

Features

  •  Admin can configure to enable/disable the OTP module.
  •  OTP verification of the customers at the time of registration.
  • Admin can enable/disable OTP verification of the customers at the time of checkout.
  •  Payment options can be chosen by the admin, for which the customers will verify OTP.
  • Admin can set email templates for OTP verification notification.
  • This module supports all Payment Methods.
  • The customer cannot reuse the expire/use OTP.
  • The customer receives the Mobile OTP (SMS) on the registered mobile if Twilio Mobile Verification is enabled otherwise customer receives the OTP on the email address.
  • The OTP string supports numeric digits only.
  • The One Time Password can resent to the customer.
  • OTP for an account cannot be used for cross customer accounts.

installation

Customers will get a zip folder and they have to extract the contents of this zip folder on their system. The extracted folder has an src folder, inside the src folder you have the app folder. You need to transfer this app folder into the Magento2 root directory on the server as shown below.

After the successful installation, you have to run these commands in the Magento2 root directory.

First command – php bin/magento setup:upgrade

Second Command – php bin/magento setup:di:compile

Third Command – php bin/magento setup:static-content:deploy

Fourth Command – composer require twilio/sdk

After running the commands, you have to flush the cache from the Magento admin panel by navigating through->System->Cache management as shown below.

Configuration For Multi-Lingual Support

For the multilingual support, the admin will navigate through Store->Configuration->General ->Locale Options and select the locale as German (the language into which admin wants to translate his store content).

Language translation

For module translation, navigate to the following path in your system app/code/Webkul/OneTimePassword/i18n/en_US.csv.
Open the file named en_US.CSV for editing as shown in the below screenshot.

Then replace the words after the comma(,) on the right in the file with your translated words.

After editing and translating the CSV file, you need to save the translated file name according to your region language and country code such as – de_DE.CSV. Followed by uploading the translated file to the same folder from where you have obtained it. Now your module translation is complete.

Module configuration

To do the module configuration in the admin panel, please navigate through Stores>Configuration>Webkul>One Time Password(OTP). Following options will appear for doing module configuration:

One time password

  • Enable Module on Frontend – Select the “YES” option to enable the module on the front end or else select “NO“.
  • Need OTP Validation On New Customer Registration – Select the “YES” option to enable OTP verification for the new customer at the time of registration or else select “NO“.
  • Need OTP Validation On Checkout – Select the “YES” option for enabling OTP validation during the checkout or else select “NO“.
  • Add Payment methods for OTP Validations – Admin can select for which payment method, he/she wants to enable the OTP verification.

OTP email settings

  • Select OTP Notification Template – Select the OTP notification template that will be sent to the new customer during REGISTRATION.
  • Select OTP Notification Template – Select the OTP notification template that will be sent to the customer at the time of CHECKOUT.

Twilio Auth

“Twilio” is a communications platform for sending and receiving text messages using it’s web service APIs. The admin can signup for the Twilio services and register to the Twilio. To register, the admin can visit Twilio and click on the signup button. 

Here, the admin can fill the required filled as shown in the image below-

Now, from the Twilio account, the admin can access the information which will be required in the admin dashboard. 

Using the Twilio, the admin can enable the Mobile OTP. To enable this, the admin has to enter the Auth Id, Token, and message. The store owner can generate these login credentials from Twilio.

  • Enable Mobile Verification – Select “YES” option to send the Mobile OTP (SMS) or else select “NO” to send the OTP through the email.
  • Auth ID – The admin has to enter Auth ID from twilio
  • Token – The admin has to enter the Token generated from the Twilio.
  • Message – In the message section the admin can enter the message format for the OTP
  • Sender number – Here admin has to enter his twilio auth registration number.

Now, Admin can click Save Config to apply your changes.

There are two scenarios to receive OTP-

  1. Through E-mail
  2. On Mobile Number (SMS)

1. OTP GENERATION (new registration)- Through E-mail

The customer will receive the E-mail OTP only if, In the twilio auth section in the OTP module, Mobile Verification is disabled by the admin.
If the admin enables the module and “Need OTP Validation On New Customer Registration” is set to “YES”, the customer will receive the OTP in the email.

The customer’s email id receives the OTP, as shown in the image below.

And OTP pop box appears, as shown in the image below.

After entering the correct OTP, customer needs to click on the submit button for completion of the process.

If in case the OTP is filled incorrect, the following image will be displayed.

OTP GENERATION (during checkout)- through e-mail

The customer will receive the OTP on E-mail only if in Twilio auth section the Mobile Verification is disabled by the admin.

If the “Need OTP Validation On Checkout” is set to “YES”.When the product is added to the cart and desired payment method is selected and the “Place Order” button is clicked.

The registered mail id will get the OTP, as shown in the image below.

The OTP pop up box will appear on the store, as shown below.

After the entering correct OTP, the submit button should be clicked for the completion of the process.

Entering the invalid OTP will generate the error message.

NOTE: The customer can use the OTP for a single time only.

2. OTP GENERATION (new registration)- Through Mobile

The customer will receive the OTP in form of SMS on Mobile only if in the twilio auth section the Mobile Verification is enabled by the admin.
If the admin enables the module and “Need OTP Validation On New Customer Registration” is set to “YES”, the customer will receive the OTP (SMS) in the mobile.

The customer receives the OTP (SMS) on the mobile, as shown in the image below.

 

And OTP pop box appears, as shown in the image below.

After entering the correct OTP, the customer needs to click on the submit button for the completion of the process.

If in case the OTP is filled incorrect, the following image will be displayed.

OTP GENERATION (during checkout)- through mobile

The customer will receive the OTP in mobile-only if, In the Twilio auth section in the OTP module, Mobile Verification is enabled by the admin.

If the “Need OTP Validation On Checkout” is set to “YES”. The customer will receive the OTP (SMS) when the product is added to the cart and the desired payment method is selected and the “Place Order” button is clicked.

The registered mobile will receive the OTP via SMS, as shown in the image below.

 

The OTP pop up box will appear on the store, as shown below.

After entering the correct OTP, the submit button should be clicked for the completion of the process and the customer will be redirected to the thank you page.

Entering the invalid OTP will generate the error message.

NOTE: The customer can use the OTP for a single time only.

That’s all for the  One Time Password(OTP) Module for Magento 2. Still, if you have any issue, feel free to add a ticket at webkul.uvdesk.com.

Current Product Version - 2.1.0

Supported Framework Version - 2.0.x, 2.1.x, 2.2.x, 2.3.x

. . .

Comments (4)

Add Your Comment

  • Allan
    Is it applicable for mobile too ?
    • gunjita joshi
      Hello Allan,

      The customer receives OTP on the registered email address only, but if you wish to have the OTP feature for mobile as well, it can be customized.

      Thanks

      • Allan
        how much the customization charged ?
        • abhishek oberoi
          Hello Allan,
          Greetings for the day!
          We have provided an update via which the customer will be able to get the OTP SMS on their registered mobile number if Twilio Mobile Verification is enabled. You can mail us at support@webkul.com and we will share you the updated module.
          Regards
          Team Webkul
  • css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again
    Close

    Index