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