Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

98
Views
using Instamojo rest api with Spring RestTemplate class

unable to make a payment request on instamojo by using instamojo rest api getting bad request(400), unable to identify why i getting 400 error. i am using spring RestTemplate class to make a post request on instamojo. Below i display the code which i am using:

    RestTemplate restTemplate = new RestTemplate();
    Map<String,Object> requestBody = new HashMap<String, Object>();
    requestBody.put("amount", "10000.00");
    requestBody.put("purpose", "just_testing_purpose");
    requestBody.put("buyer_name", "adityaPandey");
    requestBody.put("email", "robust_aditya95@xyz.com");
    requestBody.put("phone", "+919634222331");
    requestBody.put("redirect_url", "www.imthebest.in");
    requestBody.put("webhook", "");
    requestBody.put("allow_repeated_payments", false);
    requestBody.put("send_email", false);
    requestBody.put("send_sms", false);

    HttpHeaders headers = new HttpHeaders();
    headers.setContentType(MediaType.APPLICATION_JSON);
    headers.set("X-Api-Key", "me6a901b073db4715a9c540fa00af81");
    headers.set("X-Auth-Token", "k3c88da2cda6f89462d6002c9d24e80");

    HttpEntity<String> request = new HttpEntity<String>(requestBody.toString(), headers);

    HttpEntity<String> response = restTemplate.exchange("https://www.instamojo.com/api/1.1/payment-requests/", HttpMethod.POST, request, String.class);
    logger.info("MailResponse "+ response);
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

There was a problem with my requestBody data. The redirect_url field value must be with http or https, so by just making this change I am not getting 400 error anymore:

requestBody.put("redirect_url", "http://www.imthebest.in")
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!