Package com.vonage.client.verify
Class VerifyClient
java.lang.Object
com.vonage.client.verify.VerifyClient
A client for talking to the Vonage Verify API. The standard way to obtain an instance of this class is to use
VonageClient.getVerifyClient().
Send a verification request with a call to verify, confirm the code entered by the user with check,
and search in-progress or completed verification requests with search
More information on method parameters can be found on the Vonage developer portal.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadvanceVerification(String requestId) Advance a current verification request to the next stage in the process.cancelVerification(String requestId) Cancel a current verification request.check(CheckRequest request) Deprecated.Validate a code provided by a user in response to a call fromverify.psd2Verify(Psd2Request psd2Request) Send a PSD2 verification request to a phone number with optional parameterspsd2Verify(String number, Double amount, String payee) Send a PSD2 compliant payment token to a user for payment authorizationpsd2Verify(String number, Double amount, String payee, Psd2Request.Workflow workflow) Send a PSD2 compliant payment token to a user for payment authorization with a pin verification workflowSearch for a previous verification request.Search for a previous verification request.verify(VerifyRequest request) Send a verification request to a phone number.Send a verification request to a phone number.verify(String number, String brand, VerifyRequest.Workflow workflow) Send a verification request to a phone number with a pin verification workflowSend a verification request to a phone number.Send a verification request to a phone number.
-
Constructor Details
-
VerifyClient
Constructor.- Parameters:
wrapper- (required) shared HTTP wrapper object used for making REST calls.
-
-
Method Details
-
verify
public VerifyResponse verify(String number, String brand) throws VonageResponseParseException, VonageClientException Send a verification request to a phone number.- Parameters:
number- (required) The recipient's phone number in E.164 format.brand- (required) The name of the company or app to be verified for. Must not be longer than 18 characters.- Returns:
- a VerifyResponse representing the response received from the Verify API call.
- Throws:
VonageClientException- if there was a problem with the Vonage request or response objects.VonageResponseParseException- if the response from the API could not be parsed.
-
verify
public VerifyResponse verify(String number, String brand, VerifyRequest.Workflow workflow) throws VonageResponseParseException, VonageClientException Send a verification request to a phone number with a pin verification workflow- Parameters:
number- (required) The recipient's phone number in E.164 format.brand- (required) The name of the company or app to be verified for. Must not be longer than 18 characters.workflow- workflow to use for sending verification pin- Returns:
- a VerifyResponse representing the response received from the Verify API call.
- Throws:
VonageClientException- if there was a problem with the Vonage request or response objects.VonageResponseParseException- if the response from the API could not be parsed.- Since:
- 5.5.0
-
verify
public VerifyResponse verify(String number, String brand, String from) throws VonageClientException, VonageResponseParseException Send a verification request to a phone number.- Parameters:
number- (required) The recipient's phone number in E.164 format.brand- (required) The name of the company or app to be verified for. Must not be longer than 18 characters.from- (optional The Vonage number to use as the sender for the verification SMS message and calls, in E.164 format.- Returns:
- a VerifyResponse representing the response received from the Verify API call.
- Throws:
VonageClientException- if there was a problem with the Vonage request or response objects.VonageResponseParseException- if the response from the API could not be parsed.
-
verify
public VerifyResponse verify(String number, String brand, String from, int length, Locale locale) throws VonageClientException, VonageResponseParseException Send a verification request to a phone number.- Parameters:
number- (required) The recipient's phone number in E.164 format.brand- (required) The name of the company or app to be verified for. Must not be longer than 18 characters.from- (optional The Vonage number to use as the sender for the verification SMS message and calls, in E.164 format.length- (optional) The length of the verification code to be sent to the user. Must be either 4 or 6. Use -1 to use the default value.locale- (optional) Override the default locale used for verification. By default the locale is determined from the country code included innumber- Returns:
- a VerifyResponse representing the response received from the Verify API call.
- Throws:
VonageClientException- if there was a problem with the Vonage request or response objects.VonageResponseParseException- if the response from the API could not be parsed.
-
verify
public VerifyResponse verify(VerifyRequest request) throws VonageClientException, VonageResponseParseException Send a verification request to a phone number.- Parameters:
request- validation request for the 2FA verification.- Returns:
- a VerifyResponse representing the response received from the Verify API call.
- Throws:
VonageClientException- if there was a problem with the Vonage request or response objects.VonageResponseParseException- if the response from the API could not be parsed.
-
check
@Deprecated public CheckResponse check(CheckRequest request) throws VonageClientException, VonageResponseParseException Deprecated.Validate a code provided by a user in response to a call fromverify.- Parameters:
request- The request to send for validation.- Returns:
- a CheckResponse representing the response received from the API call.
- Throws:
VonageClientException- if there was a problem with the Vonage request or response objects.VonageResponseParseException- if the response from the API could not be parsed.
-
check
public CheckResponse check(String requestId, String code) throws VonageClientException, VonageResponseParseException Validate a code provided by a user in response to a call fromverify.- Parameters:
requestId- (required) The requestId returned by theverifycall.code- (required) The code entered by the user.- Returns:
- a CheckResponse representing the response received from the API call.
- Throws:
VonageClientException- if there was a problem with the Vonage request or response objects.VonageResponseParseException- if the response from the API could not be parsed.
-
search
public SearchVerifyResponse search(String requestId) throws VonageClientException, VonageResponseParseException Search for a previous verification request.- Parameters:
requestId- The requestId of a single Verify request to be looked up.- Returns:
- A SearchVerifyResponse containing the details of the Verify request that was looked up, or
nullif no record was found. - Throws:
VonageClientException- if there was a problem with the Vonage request or response objects.VonageResponseParseException- if the response from the API could not be parsed.
-
search
public SearchVerifyResponse search(String... requestIds) throws VonageClientException, VonageResponseParseException Search for a previous verification request.- Parameters:
requestIds- The requestIds of Verify requests to be looked up.- Returns:
- An array SearchVerifyResponse for each record that was found.
- Throws:
VonageClientException- if there was a problem with the Vonage request or response objects.VonageResponseParseException- if the response from the API could not be parsed.
-
advanceVerification
public ControlResponse advanceVerification(String requestId) throws VonageClientException, VonageResponseParseException Advance a current verification request to the next stage in the process.- Parameters:
requestId- The requestId of the ongoing verification request.- Returns:
- A
ControlResponserepresenting the response from the API. - Throws:
VonageClientException- if there was a problem with the Vonage request or response objects.VonageResponseParseException- if the response from the API could not be parsed.
-
cancelVerification
public ControlResponse cancelVerification(String requestId) throws VonageClientException, VonageResponseParseException Cancel a current verification request.- Parameters:
requestId- The requestId of the ongoing verification request.- Returns:
- A
ControlResponserepresenting the response from the API. - Throws:
VonageClientException- if there was a problem with the Vonage request or response objects.VonageResponseParseException- if the response from the API could not be parsed.
-
psd2Verify
public VerifyResponse psd2Verify(String number, Double amount, String payee) throws VonageClientException, VonageResponseParseException Send a PSD2 compliant payment token to a user for payment authorization- Parameters:
number- Telephone number to verify, in E.164 formatamount- payment amountpayee- name of the person the payment is for. Name will be included in the message- Returns:
- A
VerifyResponserepresenting the response from the API. - Throws:
VonageClientException- if there was a problem with the Vonage request or response objects.VonageResponseParseException- if the response from the API could not be parsed.- Since:
- 5.5.0
-
psd2Verify
public VerifyResponse psd2Verify(String number, Double amount, String payee, Psd2Request.Workflow workflow) throws VonageClientException, VonageResponseParseException Send a PSD2 compliant payment token to a user for payment authorization with a pin verification workflow- Parameters:
number- telephone number to verify, in E.164 formatamount- payment amountpayee- name of the person the payment is for. Name will be included in the messageworkflow- workflow to use for sending verification pin- Returns:
- A
VerifyResponserepresenting the response from the API. - Throws:
VonageClientException- if there was a problem with the Vonage request or response objects.VonageResponseParseException- if the response from the API could not be parsed.- Since:
- 5.5.0
-
psd2Verify
public VerifyResponse psd2Verify(Psd2Request psd2Request) throws VonageClientException, VonageResponseParseException Send a PSD2 verification request to a phone number with optional parameters- Parameters:
psd2Request- request to send PSD2 verification to a phone.- Returns:
- A VerifyResponse representing the response from the API.
- Throws:
VonageClientException- if there was a problem with the Vonage request or response objects.VonageResponseParseException- if the response from the API could not be parsed.- Since:
- 5.5.0
-
check(String, String).