#nitesh0001_82405
1 messages ยท Page 1 of 1 (latest)
Hi ๐
Can you share an API request ID for this? It will start with req_
Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
It's not visible in log
It sounds like you are making a request on a different account then
no I am using same api key
rest are functioning well
req_EgHNrTBgT5ECnw
this is the id
I am getting this error :
No payment methods found for this customer.{ "success": "false", "msg": [ "La identificaci\u00f3n del usuario no existe", "User id is does not exist" ] }
while there are multiple records of the same user
req_EgHNrTBgT5ECnw
Are you there ?
?
@zenith prism Are you there ?
Neither of these requests show an error
please share the request ID that is showing this error
This request does not have an error
I need the request that is showing the error in order to help you
Are you understanding my issue ?
No payment methods found for this customer.{ "success": "false", "msg": [ "La identificaci\u00f3n del usuario no existe", "User id is does not exist" ] }
while there are multiple records of the same user
The same user id I am using but it is showing user id doesn't exist
By "user" do you mean "customer"?
These setup intent request do not include a payment method
yes
For this request: req_EgHNrTBgT5ECnw you create a Setup intent for this customer: cus_Oj83Odmv2W5EV7
But when the attempt 3DS their card is declined so no payment method is attached
Where are you seeing a success message?
in response
To which request?
This request: https://dashboard.stripe.com/logs/req_EgHNrTBgT5ECnw only creates a Setup Intent. No payment method is created
Do you have the ID of that event? It will start with evt_
evt_1NvhymAXyAi3ow1CQBvSBg6M
Okay I am seeing a large number of attached payment methods for this customer. Where are you getinng the error that they don't have any?
What request are you using to get cards?
echo $customerId = 'cus_Oj6vVG13WJilFF'; //$customer_id2; // Replace with your customer ID
try {
$customer = \Stripe\Customer::retrieve($customerId);
var_dump($customer);
} catch (\Stripe\Exception\InvalidRequestException $e) {
echo "Invalid Request Error: " . $e->getMessage();
} catch (\Stripe\Exception\AuthenticationException $e) {
echo "Authentication Error: " . $e->getMessage();
} catch (\Stripe\Exception\ApiConnectionException $e) {
echo "API Connection Error: " . $e->getMessage();
} catch (\Stripe\Exception\ApiErrorException $e) {
echo "Stripe API Error: " . $e->getMessage();
} catch (Exception $e) {
echo "Error: " . $e->getMessage();
}
if ($customer->sources->total_count > 0) {
foreach ($customer->sources->data as $paymentMethod) {
if ($paymentMethod->object === 'card') {
$cardBrand = $paymentMethod->card->brand; // Card brand (e.g., Visa, MasterCard)
$last4Digits = $paymentMethod->card->last4; // Last 4 digits of the card number
$expMonth = $paymentMethod->card->exp_month; // Expiration month (1-12)
$expYear = $paymentMethod->card->exp_year; // Expiration year (e.g., 2023)
// Output card details (customize as needed)
echo "Card Brand: " . $cardBrand . "<br>";
echo "Last 4 Digits: " . $last4Digits . "<br>";
echo "Expiration Date: " . $expMonth . "/" . $expYear . "<br>";
}
}
} else {
echo "No payment methods found for this customer.";
}
Okay there is a lot going on here and I think you need to break this down to figure out what isn't working.
First I would log the customer returned to ensure you are getting the customer you expect (cus_Oj83Odmv2W5EV7)
Oh wait
You need to expand the sources to get the information back
It's an expandable property: https://stripe.com/docs/api/customers/object#customer_object-sources
Literally you need to do this:
$stripe = new \Stripe\StripeClient("sk_XXXXXX");
$stripe->customers->retrieve(
'cus_Oj83Odmv2W5EV7',
['expand' => ['sources',]]
);
You can read more about Expanding properties here: https://stripe.com/docs/expand
Is there anything else to do ?
DId you try that?
It is important to understand what properties are expandable in our API reference docs. For the Customer https://stripe.com/docs/api/customers/object you can see there are multiple expandable properties. These are not included by default when you retrieve the object and you must provide the property in the expand parameter when making a retrieve request if you want that data