Re: X-App-Id (VisaNet Connect - Card Services)

thai-ru
New Contributor

X-App-Id (VisaNet Connect - Card Services)

I'm testing out the New Card API https://sandbox.api.visa.com/connect/v1/cardServices/new  endpoint but i need to pass the X-App-Id
Screenshot 2024-08-17 at 20.30.56.png
Anyone with an idea on how to get it?

2 REPLIES 2
jenn_kh
Community Moderator

Re: X-App-Id (VisaNet Connect - Card Services)

Hi @thai-ru, Thank you for your question. An agent will get back to you soon. Until then, if any community member knows a solution, please feel free to reply to this thread.

API_Products
Visa Developer Support Specialist

Re: X-App-Id (VisaNet Connect - Card Services)

Hey @thai-ru,

 

To use the New Card API from Visa's sandbox, you need the `X-App-Id` for authentication. Here's how to get it:

1. Register on Visa Developer Portal:
Create an account on the [Visa Developer Portal](https://developer.visa.com/).

2. Create a New Project:
- Log in and click "Create a New Project".
- Select the New Card API.

3. Get Your Credentials:
- After creating the project, you'll receive credentials including the `X-App-Id`.
- Find the `X-App-Id` under the "Credentials" tab along with the `API Key` and `Shared Secret`.

4. Set Up Authentication:
- You may need mutual SSL authentication. Follow the guide on the Visa Developer Portal to download the certificate and configure your HTTP client.

 

Here's a Java example using Spring Boot and RestTemplate:

 

```java
// START GENAI@CHATGPT4
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class VisaCardServiceController {

@GetMapping("/newCard")
public ResponseEntity<String> getNewCard() {
String apiUrl = "https://sandbox.api.visa.com/connect/v1/cardServices/new";
RestTemplate restTemplate = new RestTemplate();

HttpHeaders headers = new HttpHeaders();
headers.set("X-App-Id", "your-app-id-here"); // Replace with your actual X-App-Id
headers.set("Authorization", "Basic your-base64-encoded-credentials-here"); // Replace with your actual authorization header

HttpEntity<String> entity = new HttpEntity<>(headers);

try {
ResponseEntity<String> response = restTemplate.exchange(apiUrl, HttpMethod.GET, entity, String.class);
return response;
} catch (Exception e) {
e.printStackTrace();
return ResponseEntity.status(500).body("Error occurred while calling Visa API");
}
}
}
// END GENAI@CHATGPT4
```

Replace `"your-app-id-here"` and `"your-base64-encoded-credentials-here"` with your actual credentials. Consult Visa Developer documentation for additional setup steps and details.




Thanks,

Diana H.



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.