razorpay / razorpay/razorpay-node
Incorrect TypeScript Typings for `fail_existing` in customers.create (should allow '0' | '1' strings)
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 243
- Forks
- 128
- PR merge metrics
- No merged PRs in 30d
Description
Steps to reproduce the behavior
-
Create a new Node.js project using TypeScript.
-
Install the Razorpay package by running:
npm install razorpay@2.9.6. -
Set up the Razorpay client with your API keys, then attempt to create a new customer using the following code:
await razorpay.customers.create({
contact: '....',
email: '....',
fail_existing: 0
});
see the video for more clarity onedrive_link
If you run this code the first time, it should work. If you try again, you may receive an error indicating that the customer already exists in your merchant account.
Expected behavior
The type definition should be:
fail_existing?: '0' | '1' | undefined;
so that valid strings are allowed.
Actual behavior
It currently allows:
fail_existing?: boolean | 1 | 0 | undefined;
which does not match actual API behavior.
Code snippets
Node version
Node v22.20.0
Library version
razorpay v2.9.6
Additional Information
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the TypeScript definition used by customers.create and compare the fail_existing type with the expected API values described in the issue. Done means the customer creation input accepts the documented string values and the package's TypeScript checks pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100