razorpay / razorpay/razorpay-node

Getting error while initiating refund in test mode

Open
#438 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
243
Forks
128
PR merge metrics
No merged PRs in 30d

Description

{
statusCode: 400,
error: {
code: 'BAD_REQUEST_ERROR',
description: 'invalid request sent',
metadata: {},
reason: 'NA',
source: 'NA',
step: 'NA'
}
}

This is the error I am getting. I have made sure the payment was captured for the paymentId also. I made 2 payment. One was made with card and other with upi and in both case I am getting the same error when trying to initiate the refund

const refund = await razorpay.payments.refund(paymentId, {
amount: refundAmount * 100,
notes: {
refundReason: "user cancelled the service",
},
receipt: "rec_1234",
});

this is refund initiation method i am using

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the test-mode call to payments.refund with the captured card and UPI payment IDs, using the request parameters shown in the issue. Check the refund API response and related repository entry points; done means identifying the cause of the BAD_REQUEST_ERROR and confirming a valid refund request or documenting the required correction.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.