razorpay / razorpay-php

Razorpay PHP Library
MIT License
186 stars 128 forks source link

Customer already exists for the merchant while creating customer - how can i get the customer id #354

Open happy-44 opened 1 year ago

happy-44 commented 1 year ago

Steps to reproduce the behavior

I am trying to create a customer by passing name and email i get error customer already exist. ( how can i get this customer ID ) i need to create virtual account for this customer.

Note: I know the customer exist , i dont have the customer id which was generated when 1st time customer was created.

Now i am not able to get customer id and not even able to create new customer with same name and email.

Expected behavior

the error should either return the customer ID which exist or allow to find customer based on email id.

Actual behavior

just returns error - customer exist

aaa

Code snippets

No response

Php version

php 7.4

Library version

RAZORPAY SDK

Additional Information

no addional info

dipesh008 commented 1 year ago

$createcustomerresponse = $api->customer->create(array('name' => $user->fname, 'email' => $user->email ));

Above line gives Customer already exists for the merchant. How can we get Customer Id of this customer

ankitdas13 commented 1 year ago

@dipesh008 Pass fail_existing with value "0" as string while creating customer. It will return the existing customer details.

Please check this doc for your reference https://razorpay.com/docs/api/customers/#create-a-customer