Magento 2 Order Verification

Magento 2 Order Verification extension help prevent fake orders by validating the orders at the checkout, via OTP sent to the mobile numbers.

 

Table of Content

  1. Extension Installation Guide
  2. Msg91 Registration
  3. Twilio Registration
  4. Create Twilio WhatsApp Templates
  5. Textlocal Registration
  6. Configuration
  7. SMS/WhatsApp API Settings
  8. OTP Custom Message Settings
  9. Order Verification via OTP in Frontend
  10. New Customer Registration Notification Settings
  11. Country Flag Settings
  12. Order Verification via OTP in Frontend
  13. Mobile Number Update Settings

 

  1. Extension Installation
  • For Magento Marketplace Customers
  • Create a folder structure in Magento root as app/code/Meetanshi/OrderVerify
  • Download and extract the zip folder and upload our extension files to the app/code/Meetanshi/OrderVerify via FTP.
  • Login to your SSH and run below commands step by step:
      • composer require twilio/sdk
  • php bin/magento setup:upgrade
  • For Magento version 2.0.x to 2.1.x - php bin/magento setup:static-content:deploy
  • For Magento version 2.2.x & above - php bin/magento setup:static-content:deploy –f
  • php bin/magento cache:flush
     
  • For Meetanshi Customers
  • Extract the zip folder and upload our extension to the root of your Magento 2 directory via FTP.
  • Login to your SSH and run below commands step by step:
      • composer require twilio/sdk
  • php bin/magento setup:upgrade
  • For Magento version 2.0.x to 2.1.x - php bin/magento setup:static-content:deploy
  • For Magento version 2.2.x & above - php bin/magento setup:static-content:deploy –f
  • php bin/magento cache:flush

 

Note: Don’t forget to install Twilio library if you are using Twilio SMS gateway or Twilio WhatsApp API for our extension.

 

  1. Msg91 Registration
    The extension allows configuration of the Msg91 SMS gateway to send OTP for the Order Verification. If you choose to use Msg91 SMS gateway integration, follow the steps below to get sender ID and API key.

     


 

    • You will get and code or a magic link in the Email to verify the Email address.


 

    • You will be asked to enter the mobile number for verification.


 

    • Enter the OTP to verify the mobile number and you will be registered successfully. Login with the credentials.

    • Under the settings, you can find the Sender ID which you need to copy and paste in the Magento 2 Order Verification extension configuration.

    • Now move to API, where you can find the API key for the Magento configuration.

  • You can find the Message type under the Send SMS tab. Select the SMS type in Msg91 configuration in Magento as per your requirement.

  1. Twilio Registration
    If you are going to use Twilio as an SMS gateway to send OTP for the Order Verification via OTP, you need to register with the Twilio to get Account SID, Auth Token and Twilio Phone Number.
    • First of all, Sign Up for the Twilio account. Add the details and click to get started.

    • After the Email verification, enter your mobile number and click to “Verify”.

    • Once you click “Verify”, you will get an OTP on the added mobile number. Enter the OTP and verify the mobile number. Now move to Settings à General where you can see API details both for live and testing. Copy the Account SID and Auth Token to use them in Magento backend configuration for Twilio account.

    • Now, click three dots from the left sidebar, go to Programmable SMS and click Build under the Learn and Build option. From here, you can get Twilio phone number to use for sending the SMSs. Click on the “Get a number” button.

    • You will get a number to choose. Click “Choose This Number”.

    • Once you click the button, you will get a Twilio phone number. Copy this number and set it in the Magento backend configuration for Twilio account. 

  1. Twilio WhatsApp Message Templates
    You need to configure the same Twilio settings to get API details for Twilio WhatsApp. Once you are done, login to your Twilio account, go to https://www.twilio.com/console/sms/whatsapp/senders/, and click on “Submit a WhatsApp Sender”.

Clicking the button will ask you to create your first Business Profile. Complete the form and submit your WhatsApp Business Profile request along with message templates.

Note: All Display Names must show consistency with the Business Name on the Facebook Business Manager provided. See Display Name rules.

 Twilio will use this information to provision your Business Profile in the next 5-10 business days.

Once your WhatsApp Sender is approved and enabled, you can see your WhatsApp number with the approved status.

Under the “WhatsApp Templates” option, click “Submit a message template”.

Make use of variables to add the message text same as Magento backend. Follow this guide to write the message template in a proper format.

  1. Textlocal Registration
    The extension allows configuration of the Textlocal SMS gateway to send OTP for the order verification. If you choose to use Textlocal SMS gateway integration, follow the steps below to get the sender ID and API key.

  • After the registration, you will get a verification link in your registered Email ID, clicking the link will land you to add additional information page. Here, add the account details and submit to activate your Textlocal account.

  • Navigate to Settings > API Keys and create new key to use. Copy the created API Key and paste it in Magento 2 extension configuration.

  • Now move to Settings > All Settings and click on “Sender Names” to get your sender name.

  • You can copy your Textlocal sender name from here and paste it in Magento 2 extension configuration.

  • Textlocal requires to create message template to send OTP verification message. Go to Send > Templates & Drafts and click to create and request new SMS template.

  • You have to create new message template for both the send and resend OTP SMS enabled in Magento 2 Order Verification extension configuration. Enter title, select category and sender name. Set message text same as SMS text in extension configuration. You have to create new SMS template in Textlocal for both the OTP texts in Magento 2. For example, create a message template for “Send OTP Text” in Textlocal having exactly the same SMS text as in Magento 2 configuration.

  • For the dynamic values in text message input, click “Insert Restricted Template Items”. Click “Insert an Input Box” and it will open a popup to create new placeholder for the dynamic value. Add placeholder text name and set maximum length for the dynamic value. Insert it into the SMS text and while sending the OTP message, this placeholder will match the variable in Magento 2 SMS text and replace it with the real value.

  • Once message templates have been created and submitted for each SMS notification, it will take approximately a week to be approved by the Textlocal. You can send OTP SMSs only after the message templates are approved by the Textlocal.
  1. Configuration
    For configuring the extension, login to Magento 2, move to Stores à Configuration à Order Verification where you can find various settings to enable the extension.
  • Order Verification: Enable the Order Verification via OTP extension from here.
  • Enable for Payment methods: Select payment methods for which you want to enable Order Verification.
  • Allowed Customer Groups: Select the customer groups for which you want to enable Order Verification.

  1. SMS/WhatsApp API Settings
    Here, you can select the SMS gateway to send SMS for the Order Verification via OTP. Make SMS/WhatsApp gateway API settings here.
  • API Provider: Select a preferred SMS gateway/WhatsApp API.
  • Sender ID: Enter sender ID provided by the SMS/WhatsApp API provider while registration.
  • Token: Enter token provided by the SMS/WhatsApp API provider while registration.
  • Twilio Number: Enter phone number provided while registration.

For Other SMS API:
If you are going to use custom SMS API other than Msg91, Twilio or Textlocal, you have to add your CURL URL as below:

Format: https://yoursmsapi.com/sms/submitsms.jsp?user=yourusername&senderid=yoursenderid&key=yoursmskey&mobile={mobile}&message={msg}

Sample CURL URL:
https://foxxsms.com/sms/submitsms.jsp?user=METANSHI&senderid=FOXGLV&accusage=6&key=587e05afbcXX&mobile={mobile}&message={msg}

  1. OTP Custom Message Settings
    Here, you can set customer text for the OTP SMS/WhatsApp message you will be sending to the customers for the Order Verification.
  • Send OTP Text: Add text for sending OTP to the customers.
  • Resend OTP Text: Enter text for the resend OTP message to the customers.

  1. SMS/WhatsApp API Testing

The store admin can also test the SMS/WhatsApp API through the SMS/WhatsApp API testing option provided in the backend. It ensures that the SMS/WhatsApp API is working properly and can be used for verifying actual orders.

  • Mobile Number With Country Code: Enter a mobile number with a country code to receive the test SMS/WhatsApp message to check the API.
  • SMS Text for Testing: Enter custom text to send as a test message to check the SMS/WhatsApp API.

  1. New Customer Registration Notification Settings
    The extension facilitates to verify customers’ mobile number using OTP at the time of registration. Configure the settings to send the OTP SMS/WhatsApp message to customers while registration.

 

  • Customer Registration Verify Mobile Number: Enable to verify customers’ mobile number via OTP on registration.
  • Registration OTP SMS Text: Enter text for OTP to send via SMS/WhatsApp for the mobile number verification.
  • Registration OTP Length: Enter the OTP length.

​​​​​​​

  1. Country Flag Settings
    The extension facilitates to enable country flag along with the mobile number fields. Configure the settings from here.
  • Enable: Enable to show the country flag in the form along with the mobile number field.
  • Allowed Countries: Select the allowed countries to show under the flag.
  • Default Country: Select the default country.

  • Mobile Number Verification on Customer Registration
    When a user signs up through the registration form, he gets the mobile number field with the country flag to add the mobile number. On click of “Create an Account” button, the user gets an OTP verification message and by entering the same he can verify the mobile number.

​​​​​​​

  1. Order Verification via OTP in Frontend
    Whenever a customer of a specific customer group tries to place an order, he gets OTP SMS or WhatsApp message on the registered mobile number.

​​​​​​​

  • OTP SMS on Registered Mobile Number
    Customer gets an OTP SMS on the registered mobile number for the order verification (if SMS API is configured).

​​​​​​​

  • OTP WhatsApp Message on Registered Mobile Number
    Customer gets an OTP WhatsApp message on the registered mobile number for the order verification (if Twilio WhatsApp API is configured).

 

  • Order Verification via OTP Successful

Once the customer enters the correct OTP and click verify button, Order Verification via OTP success message is displayed and order gets placed successfully.

  1. Mobile Number Update Settings
    Enabling this feature helps customers update their mobile numbers from their My Account section.
  • Mobile Number Update in Customer Account: Enable to allow customers update their mobile numbers from their “My Account” section.
  • Button Text Color: Set color for the button text.
  • Button Background Color: Set background color for the button.
  • Update Mobile Number OTP SMS/WhatsApp Text: Enter text for the OTP SMS/WhatsApp sent to the customers for the new mobile number verification.
  • Update Mobile Number OTP Length: Set the length of OTP sent to the customers through SMS/WhatsApp for the new mobile number verification.

​​​​​​​ 

  • Mobile Number Update from My Account
    From the frontend, customer can update the mobile number from “Mobile Number” tab from the My Account section. The customer enters new mobile number and requests for the OTP to verify the mobile number.

 

  • OTP SMS/WhatsApp in the New Mobile Number for Verification
    Immediately after the OTP request has been sent, the customer gets OTP SMS/WhatsApp in the new mobile number.

  • OTP Verification
    Immediately after the OTP is received, the customer enters and submits the OTP for the verification.

​​​​​​

  • Mobile Number Verification Success Message
    If the OTP is correct, the mobile number gets verified, the new mobile number is updated in the My Account section and success message gets displayed.