Is there any restriction format for email parameter that being sent to Midtrans?

Yes, Midtrans do validation for customer emails format for certain payment method such as Permata VA, CIMB Clicks, Telkomsel Cash, KlikBCA, Mandiri Ecash, and Indomaret

We are using regex logic for this validation. Please focus on the value that allowed by this logic, you can refer to below explanation:

interface Constants {
String ATOM = "[a-z0-9!#$%&'*+/=?^_`{|}~-]";
String DOMAIN = "(" + ATOM + "+(\\." + ATOM + "+)+";
String IP_DOMAIN = "\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\]";

String PATTERN =
"^$|^" + ATOM + "+(\\." + ATOM + "+)*@"
+ "|"
+ ")$";

ATOM is a combination of alphanumeric.
DOMAIN is a combination of DOT(".") and ATOM.
IP_DOMAIN is a combination of DOT(".") and numbers with maximum length are 3.

Example :
The right PATTERN
The wrong PATTERN

Was this article helpful?

1 person found it helpful

Back to menu