I'm trying to reach https://sandbox.api.visa.com/vcpe/v2/pan/enrollment but I'm getting a 400 error with the message "Expected input credential was not present". I'm able to reach the helloworld endpoint so my certs should be correct. I'm also using MLE for my payload.
Here is the response:
{
"responseStatus": {
"status": 400,
"code": "9125",
"severity": "ERROR",
"message": "Expected input credential was not present",
"info": ""
}
}
Code:
ng productID = "G";
String primaryAccountNumber = "xx01";
String referenceID = IdUtils.getRandomString(22);
String date = DateUtils.parseDateToStr("yyyyMMdd",DateUtils.getNowDate());
System.out.println("=======>> "+date+" referenceID:"+referenceID);
Enrollment enrollment = new Enrollment();
enrollment.setOperationType("UPDATE");
enrollment.setUpdateReferenceID(referenceID);
EnrollmentInfo enrollmentInfo = new EnrollmentInfo();
CardholderInfo cardholderInfo = new CardholderInfo();
cardholderInfo.setPrimaryAccountNumber(primaryAccountNumber);
enrollmentInfo.setCardholderInfo(cardholderInfo);
enrollment.setEnrollmentInfo(enrollmentInfo);
AccountLevelInfo accountLevelInfo = new AccountLevelInfo();
accountLevelInfo.setProductID(productID);
LinkEnrollment likeEnrollment = new LinkEnrollment();
Group group = new Group();
group.setAction("Add");
group.setGroupID("dnVgrLnzKICYNAM6PMBHbw");
group.setGroupType("LOC");
group.setIsPrimaryAccount("");
likeEnrollment.setGroup(Arrays.asList(group));
accountLevelInfo.setLinkEnrollment(likeEnrollment);
RpinEnrollment rpinEnrollment = new RpinEnrollment();
rpinEnrollment.setAccountOpenDate(date);
rpinEnrollment.setAction("Add");
rpinEnrollment.setRpin("123456");
rpinEnrollment.setRpinEffectiveDate(date);
rpinEnrollment.setRpinIssuerRefNumber("684226");
accountLevelInfo.setRpinEnrollment(rpinEnrollment);
// ReplaceEnrollment replaceEnrollment = new ReplaceEnrollment();
// replaceEnrollment.setLinkReasonCode("L");
// replaceEnrollment.setUnlinkIndicator("");
// replaceEnrollment.setOldAccountNumber("xx");
// accountLevelInfo.setReplaceEnrollment(replaceEnrollment);
CustomerContactInfo customerContactInfo = new CustomerContactInfo();
Address address = new Address();
address.setZip("");
address.setCity("FC");
address.setLine1("123 main st");
address.setLine2("apt 1");
address.setState("CA");
address.setCompanyName("VISA TEST Inc");
customerContactInfo.setAction("Add");
customerContactInfo.setEmail("test001@adbc.com");
customerContactInfo.setAddress(address);
customerContactInfo.setLastName("Smith");
customerContactInfo.setFirstName("John");
customerContactInfo.setNamePrefix("Mr");
customerContactInfo.setNameSuffix("Sr");
customerContactInfo.setMobileNumber("1000012120");
customerContactInfo.setMiddleInitial("S");
customerContactInfo.setPrefMethodOfContact("M");
accountLevelInfo.setCustomerContactInfo(customerContactInfo);
enrollmentInfo.setAccountLevelInfo(accountLevelInfo);
enrollment.setEnrollmentInfo(enrollmentInfo);
String jsonBody = JSON.toJSONString(enrollment);
String url = "https://sandbox.api.visa.com/vcpe/v2/pan/enrollment";
Map<String,String> headers = new HashMap<>();
headers.put("Content-Type","application/json");
headers.put("Accept","application/json");
headers.put("X-Request-ID", enrollment.getUpdateReferenceID());
String res = VisaOkHttpUtils.postJSON(url, jsonBody, headers);
JSONObject resObject = JSONObject.parseObject(res);
JSONObject responseStatus = resObject.getJSONObject("responseStatus");
if (responseStatus.getInteger("code")==200){
System.out.println(res);
}else{
System.err.println(responseStatus.getString("message"));
}
Request Header:
{
Accept=application/json,
X-Request-ID=F6xd0YdOcFr2H0vMJZBsAk,
Content-Type=application/json,
Authorization=Basic S1BHSk1UXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
}
Request Body:
{
"enrollmentInfo": {
"accountLevelInfo": {
"customerContactInfo": {
"action": "Add",
"address": {
"city": "FC",
"companyName": "VISA TEST Inc",
"line1": "123 main st",
"line2": "apt 1",
"state": "CA",
"zip": ""
},
"email": "test001@adbc.com",
"firstName": "John",
"lastName": "Smith",
"middleInitial": "S",
"mobileNumber": "1000012120",
"namePrefix": "Mr",
"nameSuffix": "Sr",
"prefMethodOfContact": "M"
},
"linkEnrollment": {
"group": [{
"action": "Add",
"groupID": "dnVgrLnzKICYNAM6PMBHbw",
"groupType": "LOC",
"isPrimaryAccount": ""
}]
},
"productID": "G",
"rpinEnrollment": {
"accountOpenDate": "20240118",
"action": "Add",
"rpin": "123456",
"rpinEffectiveDate": "20240118",
"rpinIssuerRefNumber": "684226"
}
},
"cardholderInfo": {
"primaryAccountNumber": "xx01"
}
},
"operationType": "UPDATE",
"updateReferenceID": "F6xd0YdOcFr2H0vMJZBsAk"
}
Response Header:
x-correlation-id:1705544507_609_1022119580_-54d479d6b66_VDP_Ws
Hi @mifapay, Thank you for reaching out! One of our agents will look into this and get back to you soon. Until then, if any community members know a solution, please feel free to respond in this thread.
Hi @mifapay,
To investigate, please provide the following information:
1. End Point
2. Request Header
3. Request Body
4. Response Header (include the x-correlation-id)
5. Response Body
You can find the x-correlation-id in the response header.
Hi @mifapay,
Thanks for providing this information. I've logged incident INC17596815 for our engineering team to investigate. We'll get back soon.
Hi @mifapay,
This API is not supported in sandbox. You'll need to submit a go live request to move into the certification environment for testing. You can refer to the Going Live guide for details.