# ID for Test
For reference only:
ID Type | Description | Country |
---|---|---|
CPF | Tax Id Number | Brazil 11 |
CNPJ | National Register of Legal Entity | Brazil 14 |
RUT | Tax Id Number | Chile (7-9 digits) |
DNI | Identity Document | Peru and Argentina (8 digits) |
CI | Identity Document | Ecuador (8-10 digits) |
CE | Foreign resident Card | Peru (8-10 digits) |
PP | Passport | Chile (9-10 digits) Ecuador (only for Cash)(9-10 digits) |
RUC | Tax Id Number | Peru and Ecuador (9-10 digits) |
PAS | Passport | Peru (9-10 digits)Ecuador (only for BankTransfer)(9-10 digits) |
CURP | Unique Population Registry Code | Mexico (18 digits) |
RFC | Federal taxpayer registration | Mexico (12~13 digits) |
CIP | Identity Document | Panama (6 digits) |
DPI | Identity Document | Guatemala (9 digits) |
CDI | Identity Document | Costa Rica (9 digits) |
Region | ID Type | Length | Regex | Example |
---|---|---|---|---|
Brazil | CPF;CNPJ | 11/14 | github | |
Argentina | CUIT;CUIL;CDI | 11 digits | ^(20|23|24|25|26|27|30|33|34)-?\d{2}[.]?\d{3}[.]?\d{3}-?\d$ | 20115872045; 27-32548697-5; 30-31.145.201-7 |
Uruguay | CI | 8 digits | ^[0-9]{1}[.]?[0-9]{0,3}[.]?[0-9]{3}[-]?[0-9]{1}$ | 8.741.777-1; 26669058 |
Uruguay | RUT | 12 digits | ^[0-9]{2}-?[0-9]{6}-?[0-9]{3}-?[0-9]{1}$ | 21-100342-001-7; 211003420017; 080101220012 |
Ecuador | CI | 8-10 digits | ^\d.?\d{3}.?\d{3}-?\d$ | 1004922993 |
Ecuador | CE | 10 digits | ^([0-1][0-9]|2[0-4])[0-5]\d{6}(\-)?[0-9]$ | 0603027988 |
Ecuador | RUC | 13 digits | [0-9]{13} | 1391727259001 |
Peru | DNI | 8 digits | ^[\d]{1,3}.?[\d]{3,3}.?[\d]{3,3}$ | 30784589 |
Peru | RUC | 11 digits | [0-9]{11} | 20538995364 |
Colombia | CC | 6~10 digits | ^[0-9]{0,1}[.]?[0-9]{0,3}[.]?[0-9]{3}[.]?[0-9]{3}$ | 487245 |
Colombia | NIT | 10 digits | ^[0-9]{3}[.]?[0-9]{3}[.]?[0-9]{3}-?[0-9]$ | 9014586527 |
Colombia | CE | up to 12 | ^[a-zA-Z0-9]{5,12}$ | A20106607 7001115243 |
Bolivia | CI | 7~9 | It is formed with 7 mandatory numerical digits and then optionally a space and two letters. The two letters represent the departments belonging to the “ Plurinational State of Bolivia”. E.g. BE, CB, CH, LP, OR, PD, PT, SC, TJ. e.g. “SC 1234567”, “1234567”, “SC1234567”, “1234567SC” or “1234567 SC” | SC 1234567, 1234567,SC1234567,1234567SC,1234567 SC |
Bolivia | CE | 8 | ||
Bolivia | NIT | 9~12 | 123456789 | |
Paraguay | CI | 7 digits | 1234567 | |
Paraguay | RUC | 8~9 digits | 12345678 |
# Certificate rule verification JavaScript Library
luxpagSDK.min.js can be used for certificate formatting and compliance 。
# steps
# 1. Reference luxpagSDK.min.js to your payment page
<script src="https://res.luxpag.com/lib/js/luxpagSDK.min.js"></script>
# 2. Parameter Validation
Method | Parameter | Parameter 2 | Return | Description |
---|---|---|---|---|
formatId(value, code) | (string) Id to be formatted | (string) ISO 3166, 3 digit country code (MEX, CHL, COL, PER, ECU, BRA, PAN, CRI, SLV, GTM, NIC) | (string) formatted id | IDs can beformatted: (CPF/CNPJ, RFC, NIT/CC, RUT/RUN, DNI/RUC, RUC, CIP, DUI, DPI) |
validateId(value, code) | (string) Id to be validated | (string) ISO 3166, 3 digit country code (MEX, CHL, COL, PER, ECU, BRA, PAN, CRI, SLV, GTM, NIC) | (list) [isIdvalid (boolean), idType (string) ] | IDs can bevalidated: CPF/CNPJ, RFC, NIT/CC, RUT/RUN, DNI/RUC, RUC, CIP, DUI, DPI |
validateName(value) | (string) name to be validated | - | | Only canbeused in MEX, CHL, COL, PER, ECU, BRA, PAN, CRI, SLV, GTM, NIC |
validateEmail(value) | (string) email to be validated | - | (boolean) true/false | /^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/g |
formatCEP(value) | (string) CEP (zip code) to be formatted | - | (string) formatted CEP (zip code) | |
validateCEP(value) | (string) CEP to be validated | - | (boolean) true/false | |
clearData(value) | (string) Data to be cleared in order to get rid of unnecessary characters (-/.). | - | (string) cleared data | Before theAPI request formattedparameters must be cleared |
formatPostalCode(valu e, code) | (string) zip code to be formatted | (string) ISO 3166, 3 digit country code (MEX, CHL, COL, PER, BRA) | string | formatted CEP(zip code). |
validatePostalCode(val ue, code) | (string) zip code to be formatted | (string) ISO 3166, 3 digit country code (MEX, CHL, COL, PER, BRA) | string | validated CEP(zip code). |
validateMobilePhone(value, code) | (string) mobile phone number to be validated | (string) ISO 3166, 2 digit country code (MX, CL, CO, PE, BR etc.) | (boolean) true/false(string) error message | validated phone |
# 3. for example:
https://res.luxpag.com/lib/sdkExample.html
luxpagSDK.formatId("50284414727","BRA") // 502.844.147-27
luxpagSDK.validateId("502.844.147-27", "BRA") // [true, 'CPF']
luxpagSDK.clearData("502.844.147-27") // 50284414727
luxpagSDK.validateMobilePhone("75991435892", "BR");// [true]
<script type="text/javascript" src="https://res.luxpag.com/lib/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="https://res.luxpag.com/lib/js/luxpagSDK.min.js"></script>
<label for="">RFC: </label>
<input type="text" id="input-rfc" /> <button id="submit-mx-id">Submit RFC</button>
<br />
<br />
<label for="">CPF/CNPJ: </label>
<input type="text" id="input-br-id" /> <button id="submit-br-id">Submit CPF/CNPJ</button>
<br />
<br />
<label for="">CEP: </label>
<input type="text" id="input-cep" /> <button id="submit-cep">Submit CEP</button>
<br />
<br />
<label for="">Postal code: </label>
<select id="countries">
<option value="BRA">Brasil</option>
<option value="MEX">Mexico</option>
<option value="CHL">Chile</option>
<option value="COL">Colombia</option>
<option value="PER">Peru</option>
</select>
<input type="text" id="input-postal-code" /> <button id="submit-postal-code">Submit Postal Code</button>
<br />
<script type="87f1b3200af765c0f2113510-text/javascript" charset="utf-8">
$("#input-rfc").on("input", (e) => {
const value = e.target.value;
const idNode = $("#input-rfc");
const formattedId = luxpagSDK.formatId(value, "MEX");
idNode.val(formattedId);
const [isIdvalid, idType] = luxpagSDK.validateId(idNode.val(), "MEX");
if (isIdvalid === true) {
idNode.removeClass("error");
} else {
idNode.addClass("error");
}
});
$("#submit-mx-id").click(() => {
const idNode = $("#input-rfc");
const [isIdvalid, idType] = luxpagSDK.validateId(idNode.val(), "MEX");
if (isIdvalid === true) {
const requestData = {
customer: {
identify: {
number: luxpagSDK.clearData(idNode.val()),
type: idType,
}, // .....
},
};
window.alert(JSON.stringify(requestData));
}
});
$("#input-br-id").on("input", (e) => {
const value = e.target.value;
const idNode = $("#input-br-id");
const formattedId = luxpagSDK.formatId(value, "BRA");
idNode.val(formattedId);
const [isIdvalid, idType] = luxpagSDK.validateId(idNode.val(), "BRA");
if (isIdvalid === true) {
idNode.removeClass("error");
} else {
idNode.addClass("error");
}
});
$("#submit-br-id").click(() => {
const idNode = $("#input-br-id");
const [isIdvalid, idType] = luxpagSDK.validateId(idNode.val(), "BRA");
if (isIdvalid === true) {
const requestData = {
customer: {
identify: {
number: luxpagSDK.clearData(idNode.val()),
type: idType,
}, // .....
},
};
window.alert(JSON.stringify(requestData));
}
});
$("#input-cep").on("input", (e) => {
const value = e.target.value;
const cepNode = $("#input-cep");
const formattedCep = luxpagSDK.formatCEP(value);
cepNode.val(formattedCep);
const isCepValid = luxpagSDK.validateCEP(cepNode.val());
if (isCepValid === true) {
cepNode.removeClass("error");
} else {
cepNode.addClass("error");
}
});
$("#submit-cep").click(() => {
const cepNode = $("#input-cep");
const isCepValid = luxpagSDK.validateCEP(cepNode.val());
if (isCepValid === true) {
const requestData = {
customer: {
address: {
zip_code: luxpagSDK.clearData(cepNode.val()),
},
},
};
window.alert(JSON.stringify(requestData));
}
});
$("#input-postal-code").on("input", (e) => {
const value = e.target.value;
const postalCodeNode = $("#input-postal-code");
const countryCodeNode = $("#countries");
const formattedPostalCode = luxpagSDK.formatPostalCode(value, countryCodeNode.val());
postalCodeNode.val(formattedPostalCode);
console.log("formattedPostalCode", formattedPostalCode);
const isPostalCodeValid = luxpagSDK.validatePostalCode(postalCodeNode.val(), countryCodeNode.val());
console.log("isPostalCodeValid", isPostalCodeValid);
if (isPostalCodeValid === true) {
postalCodeNode.removeClass("error");
} else {
postalCodeNode.addClass("error");
}
});
$("#submit-postal-code").click(() => {
const countryCodeNode = $("#countries");
const postalCodeNode = $("#input-postal-code");
const isPostalCodeValid = luxpagSDK.validatePostalCode(postalCodeNode.val(), countryCodeNode.val());
if (isPostalCodeValid === true) {
const requestData = {
customer: {
address: {
zip_code: luxpagSDK.clearData(postalCodeNode.val()),
},
},
};
window.alert(JSON.stringify(requestData));
}
});
$("#countries").change((e) => {
countryCode = e.target.value;
const postalCodeNode = $("#input-postal-code");
const isPostalCodeValid = luxpagSDK.validatePostalCode(postalCodeNode.val(), countryCode);
if (isPostalCodeValid === true) {
postalCodeNode.removeClass("error");
} else {
postalCodeNode.addClass("error");
}
});
</script>