Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5% Failure Rate of Payment Transfer to Bank Accounts via Route (RazorpayException BAD_REQUEST_ERROR:The id provided does not exist) #321

Open
SushSpaceBasic opened this issue Aug 3, 2024 · 0 comments

Comments

@SushSpaceBasic
Copy link

SushSpaceBasic commented Aug 3, 2024

I work at a start-up and we use Razorpay payment gateway to collect payments from our client's customers'. We have added the client bank accounts in our Razorpay account and use routing to transfer the amount to the client using the "Route" feature of Razorpay. We are experiencing a 5% failure of payment transfers in a day when there are a more than 1000 transactions being made in a day.

I'm using this code snippet to transfer the amount (razorpay-java-1.4.3)

Map<String, Object> paymentPayload = (Map<String, Object>) payload.get("payload");
Map<String, Object> payment = (Map<String, Object>) paymentPayload.get("payment");
Map<String, Object> paymentEntity = (Map<String, Object>) payment.get("entity");

String paymentId = String.valueOf(paymentEntity.get("id"));

RazorpayClient razorpay = new RazorpayClient(razorpayMID, razorpaySecretKey);

JSONObject createOrderRequest = new JSONObject();
JSONObject request = new JSONObject();
JSONArray transfers = new JSONArray();

createOrderRequest.put(AMOUNT, amountToBeTransferred);
createOrderRequest.put(CURRENCY, "INR");
createOrderRequest.put("account", accountId);
transfers.put(createOrderRequest);
request.put("transfers", transfers);

List<Transfer> razorpayTransfers = razorpay.payments.transfer(paymentId, request);

The transfer method in the last line fails with this error: RazorpayException BAD_REQUEST_ERROR:The id provided does not exist

JSON body of the transfer API (payload):

{
    "account_id": "acc_qwerty",
    "contains": [
        "payment"
    ],
    "created_at": 1721298486,
    "entity": "event",
    "event": "payment.captured",
    "payload": {
        "payment": {
            "entity": {
                "acquirer_data": {
                    "rrn": "0987654321"
                },
                "amount": 1101233,
                "amount_refunded": 0,
                "bank": null,
                "base_amount": 1101233,
                "captured": true,
                "card_id": null,
                "contact": "+911234567890",
                "created_at": 1721298485,
                "currency": "INR",
                "description": "qwerty",
                "email": "[[email protected]](mailto:[email protected])",
                "entity": "payment",
                "error_code": null,
                "error_description": null,
                "error_reason": null,
                "error_source": null,
                "error_step": null,
                "fee": 0,
                "id": "pay_xyz",
                "international": false,
                "invoice_id": null,
                "method": "upi",
                "notes": {
                    "amountPaid": "1100000",
                    "convenienceCharges": "1233",
                    "proformaOrderId": "123",
                    "proformaOrderNo": "456",
                    "regNo": "112233",
                    "selectedPaymentMethod": "upi",
                    "studentId": "445566",
                    "tenantId": "999",
                    "type": "payment"
                },
                "order_id": "order_abc",
                "refund_status": null,
                "reward": null,
                "status": "captured",
                "tax": 0,
                "upi": {
                    "payer_account_type": "bank_account",
                    "vpa": "johndoe@abc"
                },
                "vpa": "johndoe@abc",
                "wallet": null
            }
        }
    }
}

Note: Replaced all sensitive information.

The error message is not helpful because the payment ID is valid. What is the error message trying to say? The payment ID is not yet recorded in Razorpay's system?

We tried contacting the Razorpay support but we did not receive any help in this issue. Did anyone else face this issue before? If so, how did you overcome this issue?

@SushSpaceBasic SushSpaceBasic changed the title 5% Failure of Payment Transfer to Bank Accounts via Route (RazorpayException BAD_REQUEST_ERROR:The id provided does not exist ) 5% Failure of Payment Transfer to Bank Accounts via Route (RazorpayException BAD_REQUEST_ERROR:The id provided does not exist) Aug 3, 2024
@SushSpaceBasic SushSpaceBasic changed the title 5% Failure of Payment Transfer to Bank Accounts via Route (RazorpayException BAD_REQUEST_ERROR:The id provided does not exist) 5% Failure Rate of Payment Transfer to Bank Accounts via Route (RazorpayException BAD_REQUEST_ERROR:The id provided does not exist) Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant