Re: Visa In-App provisioning with Apple Pay/Samsung Pay internal server error

udayaramu
Helper

Visa In-App provisioning with Apple Pay/Samsung Pay internal server error

I am trying to use the VISA in-App provisioning API, I am using the Java sample code that is available in the assets section.

I am using X-pay token for authentication and asymmetric encryption for FLE (Field Level Encryption).

I have been able to used the Universal card enrollment API for enrolling cards as per the Test data in the project.

I was also able to provision for Google pay.

As for Samsung pay, when I am using the encCard as the card field in the request payload, I am able to provision for Samsung pay, but with vCardID I am not able to, it is giving internal server error and "sometimes resource not found error".

As for Apple Pay when I am trying to execute the test case present in the sample code with the test data for Apple wallet provisioning, it is giving 500 internal server error.

Could you help me out on this, or provide the latest sample data for Apple Pay and Samsung pay

3 REPLIES 3
SyedSa
Community Moderator

Re: Visa In-App provisioning with Apple Pay/Samsung Pay internal server error

Hi @udayaramu, Thank you for reaching out. An agent will get back to you as soon as possible. Until then, if any community member knows a solution, feel free to reply in this thread.

DianaVisaPM
Visa Developer Support Specialist

Re: Visa In-App provisioning with Apple Pay/Samsung Pay internal server error

Hey @udayaramu,

 

Thank you for your detailed question regarding Visa In-App provisioning with Apple Pay and Samsung Pay. It sounds like you're encountering issues with the provisioning process, specifically when using `vCardID` for Samsung Pay and the test data for Apple Pay.

 

Please refer to this community forum link to troubleshoot the error and make sure to download the attached PEM file: https://community.developer.visa.com/t5/New-to-Visa-Developer/In-App-Provisioning-for-Apple-Pay/m-p/... 

 

Also, here are a few steps and considerations that might help resolve the issues:

1. Check API Endpoint and Payload: Ensure that you are using the correct API endpoint and that your request payload strictly adheres to the specifications provided in the Visa Developer API documentation.

2. Error Handling: The `500 internal server error` typically indicates an issue on the server-side. Double-check your request payload for any discrepancies or missing required fields.

3. Field-Level Encryption (FLE): Since you are using asymmetric encryption for FLE, ensure that the encryption process is correctly implemented and that the encrypted data is correctly formatted.

4. X-Pay Token: Verify that the `X-Pay Token` is correctly generated and that it has not expired. Any issues with token generation or expiration can lead to authentication failures.

5. Latest Sample Data: Ensure that you are using the latest sample data provided by Visa for Apple Pay and Samsung Pay. You can find the latest sample data and API reference on the Visa Developer Platform.

 

Here is a simplified example of how you might structure your Java request for Apple Pay and Samsung Pay provisioning:

```java
// START 
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Base64;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;

public class VisaInAppProvisioning {

public static void main(String[] args) {
try {
String apiEndpoint = "https://sandbox.api.visa.com/vdp/endpoint"; // Replace with actual endpoint
String xPayToken = "your-x-pay-token"; // Replace with your X-Pay Token
String requestPayload = "{ /* Your request payload */ }"; // Replace with your actual payload

URL url = new URL(apiEndpoint);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("X-Pay-Token", xPayToken);
connection.setDoOutput(true);

// Write request payload
connection.getOutputStream().write(requestPayload.getBytes("UTF-8"));

int responseCode = connection.getResponseCode();
if (responseCode == 200) {
System.out.println("Provisioning successful!");
} else {
System.out.println("Error: " + responseCode);
}
} catch (Exception e) {
e.printStackTrace();
}
}

private static String encryptData(String data, String encryptionKey) throws Exception {
byte[] key = Base64.getDecoder().decode(encryptionKey);
SecretKeySpec secretKey = new SecretKeySpec(key, "AES");

Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, secretKey);

byte[] encryptedData = cipher.doFinal(data.getBytes("UTF-8"));
return Base64.getEncoder().encodeToString(encryptedData);
}
}
// END 
```

 

Note: This is a simplified example; you will need to replace placeholders with actual values and handle encryption and token generation as per your project's requirements.

If the issue persists, you might want to contact Visa Developer support directly for more detailed assistance. They can provide the latest sample data for Apple Pay and Samsung Pay and help troubleshoot the internal server errors.

 




Thanks,

Diana



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

udayaramu
Helper

Re: Visa In-App provisioning with Apple Pay/Samsung Pay internal server error

@DianaVisaPMcould you tell me how can I contact Visa Developer support directly for more detailed assistance ?