razorpay / razorpay-java

Razorpay Java SDK
https://mvnrepository.com/artifact/com.razorpay/razorpay-java
MIT License
58 stars 67 forks source link

BAD_REQUEST_ERROR:Account number is mandatory for this merchant #303

Open Shekhar-J-Lobo opened 10 months ago

Shekhar-J-Lobo commented 10 months ago

I'm trying to generate the orderId in Razorpay, and I'm following the steps given in documentation https://razorpay.com/docs/payments/server-integration/java/payment-gateway/build-integration/#api-sample-code . But its throwing an error saying com.razorpay.RazorpayException: BAD_REQUEST_ERROR:Account number is mandatory for this merchant

My code: `RazorpayClient client = null; try { client = new RazorpayClient("[YOUR_KEY_ID]", "[YOUR_KEY_SECRET]"); JSONObject options = new JSONObject(); options.put("amount", 100); options.put("currency", "INR"); options.put("receipt", "order_receipt_id"); Order order = client.orders.create(options); System.out.println("ORDER Details: "+order);

        String orderId = order.get("id");  // Corrected property name to lowercase "id"
        System.out.println("ORDER ID: " + orderId);
        response.getWriter().append(orderId);
    }catch(Exception e){
        e.printStackTrace();
    }`

Note: I've added my key id and key secret in their respective "[YOUR_KEY_ID]", "[YOUR_KEY_SECRET]"

Then I tried adding

options.put("account_number", "[accNO]"); then it threw a different error saying Internal server error try after some time... and I've tried many times but still nothing.

and the Razorpay version I'm using is 1.4.3