Card on file API
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Card on file API
Hi,
I am trying to call the visa card on file api.
But i am getting 401 unauthorized exception.
I am using the same username and password which is available at visa portal while creating a project.
Request Payload is getting encrypted with server public key, but while accessing the api getting the error.
Even i downloaded the sample code from visa portal but with that also i am getting the same error.
Please help me out to resolve the error.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Card on file API
Hi,
Can you please share the following to debug further ?
1. Request Header & Request Body
2. Response Header & Response Body
3. x-correlation-id from from response header.
Kindly share the sample code and error logs along with the above to developer@visa.com, so we can investigate further.
Thanks,
Jai
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Card on file API
public CardOnFileDataInquirypostResponse COFIssuerService(CardOnFileDataInquirypostPayload cardOnFileDataInquirypostPayload) {
HttpHeaders headers = new HttpHeaders();
String authCode = Base64Utils.encodeToString(String.format("%s:%s",visaConfigProps.get(USER_NAME),visaConfigProps.get(PASSWORD)).getBytes());
headers.add(AUTHORIZATION, AUTHORIZATION_PREFIX + authCode);
headers.add(ACCEPT, "application/json");
headers.add("Content-Type","application/json");
RestTemplate restTemplate = getSecuredRestTemplate();
String keyId="6f0df2a4-c624-44eb-9fc0-ec5a616fad8a";
String path = UriComponentsBuilder.fromPath(visaConfigProps.getProperty(COF_ISSUER_SERVICE_URL)).build().toUriString();
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(visaConfigProps.getProperty(DOMAIN)).path(path);
final BodyBuilder requestBuilder = RequestEntity.method(HttpMethod.POST, builder.build().toUri());
addHeadersToRequest(headers, requestBuilder);
RequestEntity<Object> requestEntity = requestBuilder.body(getEncryptedPayload(cardOnFileDataInquirypostPayload, keyId));
ParameterizedTypeReference<EncryptedResponse> encryptedResponseType = new ParameterizedTypeReference<EncryptedResponse>() {};
ResponseEntity<EncryptedResponse> responseEntity = restTemplate.exchange(requestEntity, encryptedResponseType);
EncryptedResponse encryptedPayload = responseEntity.getBody();
CardOnFileDataInquirypostResponse decryptedResponse = getDecryptedPayload(encryptedPayload, CardOnFileDataInquirypostResponse.class);
return decryptedResponse;
}
Exception in thread "main" org.springframework.web.client.HttpClientErrorException: 401 Unauthorized
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Card on file API
Hi,
Thanks for sharing the details on the developer@visa.com. We have shipped the working code to you. Kindly let us know if you have any further questions.
Thanks,
Jai
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Card on file API
Hi
As you said that you have shipped the working code.
Can you please guide me where it is available on visa portal.
Thanks
Khusha
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Card on file API
Hi Khusha,
We will eventually publish it on portal in our forthcoming release. All sample codes in general are available in VDP Dashboard --> Sample Code section.
Thanks for confirming that you have received the code from developer@visa.com
Thanks,
Jai
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Card on file API
I am able to get success response but unable to decrypt. please help me
JWEHeader.Builder headerBuilder = new JWEHeader.Builder(
JWEAlgorithm.RSA_OAEP_256,
EncryptionMethod.A128GCM);
//Get the keyId from developer portal and substitute in the place holder <keyId from the developer portal> below:
headerBuilder.keyID(visaCardOnFileConfigProperties.getKeyId());
////
//Decrypt... am unable to ... please help
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Card on file API
Please Check Support URL for queries: https://developer.visa.com/pages/support