Open OutdatedGuy opened 1 year ago
@ankitdas13 @razorpay can you check on this?
@OutdatedGuy Apologies for the long delay, if you want to throw an error if the customer already existed then dont pass fail_existing
property . Please check this doc for more detail
https://razorpay.com/docs/api/customers/create
@OutdatedGuy Apologies for the long delay, if you want to throw an error if the customer already existed then dont pass
fail_existing
property . Please check this doc for more detail https://razorpay.com/docs/api/customers/create
@ankitdas13 the docs you mentioned says that if the value of fail_existing
property is set to 0
it should return data of the existing customer, NOT throw error.
I want to retrieve the data of existing customer if available, but the code is throwing error instead.
@OutdatedGuy Here I'm creating the same customer which is already existing
fail_existing
with 0 (Getting the data of the existing customer)
fail_existing
with 1 (throw error)
@ankitdas13 Which version of the package are you using? Can you give link to the example above as a repo?
Yo @ankitdas13, below is the code I'm using to create customers and retrieve if already present:
razorpayInstance.customers.create({
name: userDoc.data()?.name ?? "User",
contact: request.auth.token.phone_number,
fail_existing: 0,
});
And this is the error I'm getting if the customer with same details is already present:
{
statusCode: 400,
error: {
code: 'BAD_REQUEST_ERROR',
description: 'Customer already exists for the merchant',
source: 'NA',
step: 'NA',
reason: 'NA',
metadata: {}
}
}
I'm using razorpay version v2.9.2
and a demo razorpay testing key rzp_test_xxxxxx
.
I have tried using a live production key just in case and it still throws the error. Please help.
@OutdatedGuy Apologise for the delay. Have you resolved this issue?
@ankitdas13, No, It's giving me the same issue mentioned in this comment.
for me also the same issue , but while i am trying from public postman collection apis its working as expected but not with node-sdk
just pass
fail_existing: "0"
instead of
fail_existing: 0
It seems to be working fine with this.
@nimesh-trackerbin cannot do that in typescript:
@ankitdas13 looks like the issue is when normalizeBoolean
is removed in v2.9.2
. I checked and the package is working fine in version v2.9.1
Can you verify and fix this ASAP? @ankitdas13
Hi @ankitdas13, is this issue being worked on? We are unable to update the package due to this issue.
Steps to reproduce the behavior
Expected behavior
If customer with similar data already exists, their data should be returned when
fail_existing
is set to 0.Actual behavior
Error is thrown when customer is similar data already exists.
Code snippets
Node version
Node v18.17.1
Library version
razorpay v2.9.2
Additional Information
No response