Version Error

org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request: "{"message":"version value should be 2021-05-21 or 2022-01-01 or 2022-09-01 or 2023-08-01 or 2025-01-01 tried all this dates still getting version error.
31 Replies
JavaBot
JavaBot3w ago
This post has been reserved for your question.
Hey @Maxxx005! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
ayylmao123xdd
ayylmao123xdd3w ago
show the code for validation
dan1st
dan1st3w ago
@KineticMate Pasting unsolicited LLM responses isn't helpful. If someone wants an LLM response, they can ask the LLM. See #❗︱how-to-get-help
Maxxx005
Maxxx005OP3w ago
Controller and service
Maxxx005
Maxxx005OP3w ago
i am using cashfree api for the payment gateway
dan1st
dan1st3w ago
I think it should be x-api-version and not just version
dan1st
dan1st3w ago
Cashfree Payments Developer Documentation
Cashfree Payments Developer Documentation
Welcome to the Cashfree Payments developer documentation. You will find help about Cashfree Payments products and APIs that will help you start using our products quickly.
dan1st
dan1st3w ago
The current version is 2023-08-01 and 2025-01-01 is an "upcoming version" or beta
No description
No description
dan1st
dan1st3w ago
I think you can also just use v4 for the version there ping
Maxxx005
Maxxx005OP3w ago
what changes do i need to make in my code?
dan1st
dan1st3w ago
private HttpHeaders createHeaders() {
String version = "2025-01-01";
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("x-client-id", appId);
headers.set("x-client-secret", secretKey);
headers.set("version", version); // Dynamically use the version from properties
System.out.println("Using API Version: " + headers.get("version")); // Log version
return headers;
}
private HttpHeaders createHeaders() {
String version = "2025-01-01";
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("x-client-id", appId);
headers.set("x-client-secret", secretKey);
headers.set("version", version); // Dynamically use the version from properties
System.out.println("Using API Version: " + headers.get("version")); // Log version
return headers;
}
change the headers.set("version", version); to headers.set("x-api-version", version); and you might also want to use 2023-08-01
JavaBot
JavaBot3w ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Maxxx005
Maxxx005OP3w ago
Using API Version: null 2025-01-08T12:06:55.065+05:30 ERROR 14620 --- [Connect] [nio-8082-exec-5] o.a.c.c.C.[.[.[/].[dispatcherServlet]  : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: java.lang.RuntimeException: Error while creating subscription: Exception while creating order: null] with root cause java.lang.NullPointerException: null after your suggested changes i am getting this exception
dan1st
dan1st3w ago
Can you show the full stack trace?
JavaBot
JavaBot3w ago
See this StackOverflow post for NullPointerExceptions and how to solve them.
dan1st
dan1st3w ago
What's line 56 of CashFreeService? Also are you using Spring 5?
Maxxx005
Maxxx005OP3w ago
I am using spring 3.2.5
dan1st
dan1st3w ago
ah right it's Objects.requireNonNull .
Maxxx005
Maxxx005OP3w ago
body.put("customer_details", Map.of( "customer_id", customerId, "customer_email", customerEmail, "customer_phone", customerPhone line 56,57,58,59
dan1st
dan1st3w ago
so one of customerId, customerEmail or customerPhone is null
Maxxx005
Maxxx005OP3w ago
ok let me check yes you are correct i am not storing phone number so it shoould be null.
dan1st
dan1st3w ago
Map.of doesn't work with null arguments you could just create a HashMap and put the individual elements in it possibly ignoring the null element
Maxxx005
Maxxx005OP3w ago
okay so now i have included number as well so could you tell me that will it require +91 etc. kind of formatted number?
dan1st
dan1st3w ago
?
Maxxx005
Maxxx005OP3w ago
like some of the api only accept formatted numbers like in the prefix of the number you must include the country code .
dan1st
dan1st3w ago
just send it as a string formatted correctly
Maxxx005
Maxxx005OP3w ago
Finally my payment gateway has started working Thank you so much sir for your help. It really means a lot to me!! Your Answers were really accurate and helped me a lot solve my problems. This community is the best java community. It has all the help that a learning developer requires. Thank you so much once again!!!!
JavaBot
JavaBot3w ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
dan1st
dan1st3w ago
no problem
JavaBot
JavaBot2w ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.

Did you find this page helpful?