Rate this page:

Verify Transactions for PSD2

To enable PSD2 mode on your account, contact Twilio Support.

What is PSD2?

PSD2 is the short name for Payment Service Directive 2, a set of regulations introduced by the European Banking Authority aimed at combating the rising costs of fraud. PSD2 requires Strong Customer Authentication (SCA) for online transactions involving more than 30 Euros. To learn more about PSD2, SCA, and dynamic linking check out this post.

Get started with Verify for PSD2

Twilio Verify already allows you to quickly verify phone number ownership with one-time passwords (OTP) over SMS. In a few steps, you can extend these capabilities to help comply with PSD2 by verifying transactions using dynamic linking and Strong Customer Authentication (SCA).

Enable PSD2 on your account

First, you must contact Twilio Support to enable PSD2 mode on your account.

Create a Service with PSD2 enabled

Next, create a new Service with PSD2 mode enabled, as shown in the code sample below.

Once enabled, requests to start and/or complete verifications require the Payee and Amount parameters.

Loading Code Sample...

        Create a PSD2 Enabled Verify Service

        Start a transaction verification

        To start a transaction verification, send an HTTP POST request to your PSD2-enabled Service's Verifications resource. This request must contain the Amount, Payee, To, and Channel parameters.

        This HTTP request causes Twilio to send a verification code to the user. Each verification code is dynamically-linked to the Amount and Payee of each transaction. The code is unique to the To (e.g., the recipient's phone number), Amount, and Payee combination. This ensures that verification fails in the event of code interception or transaction mutations.

        Each verification code is valid for 10 minutes. Within that ten-minute time frame, any subsequent HTTP POST requests to the Verifications resource for the transaction cause Twilio send the same verification code.

        Loading Code Sample...

              Start a PSD2 verification

              For some regions, Twilio is unable to return carrier and cellphone data by default. To enable these regions, contact Twilio Support.

              More information can be found in the Help Center.

              Complete a transaction verification

              To check if a verification code is correct, send an HTTP POST request to your PSD2-enabled Service's Verification Check resource. This request must contain the Code, To (e.g., the user's phone number), Amount, and Payee parameters. A sample request is shown in the example below.

              Loading Code Sample...

                    Complete a PSD2 Verification

                    Cancel a transaction verification

                    In some instances, the details of a transaction may change before it can be completed. When that occurs, you can cancel an in-progress transaction verification by updating the Status of the Verification resource. An example of this request is shown below.

                    This prevents a user from verifying an out-of-date transaction.

                    That transactions that have been successfully verified cannot be canceled.

                    Loading Code Sample...

                          Cancel a Transaction Verification

                          Rate this page:

                          Need some help?

                          We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

                          Loading Code Sample...

                                Thank you for your feedback!

                                Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

                                Sending your feedback...
                                🎉 Thank you for your feedback!
                                Something went wrong. Please try again.

                                Thanks for your feedback!