To enable PSD2 mode on your account, contact Twilio Support.
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.
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).
First, you must contact Twilio Support to enable PSD2 mode on your account.
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
To start a transaction verification, send an HTTP POST request to your PSD2-enabled Service's Verifications resource. This request must contain the
This HTTP request causes Twilio to send a verification code to the user. Each verification code is dynamically-linked to the
Payee of each transaction. The code is unique to the
To (e.g., the recipient's phone number),
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.
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
To (e.g., the user's phone number),
Payee parameters. A sample request is shown in the example below.
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.