#nitesh0001_82405

1 messages ยท Page 1 of 1 (latest)

native oysterBOT
zenith prism
cold ingot
#

It's not visible in log

zenith prism
#

It sounds like you are making a request on a different account then

cold ingot
#

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 ?

zenith prism
#

Hi ๐Ÿ‘‹

#

The server is a little busy and I'm the only one answering questions.

cold ingot
#

Please do fast. I am too late

#

its 10 PM

zenith prism
#

Neither of these requests show an error

#

please share the request ID that is showing this error

cold ingot
#

req_EgHNrTBgT5ECnw

#

Please reply fast

zenith prism
#

This request does not have an error

#

I need the request that is showing the error in order to help you

cold ingot
#

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

zenith prism
#

By "user" do you mean "customer"?

#

These setup intent request do not include a payment method

cold ingot
#

yes

zenith prism
#

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

cold ingot
#

But it's showing success message

#

when I am adding card

zenith prism
#

Where are you seeing a success message?

cold ingot
#

in response

zenith prism
#

To which request?

cold ingot
zenith prism
#

Do you have the ID of that event? It will start with evt_

cold ingot
#

evt_1NvhymAXyAi3ow1CQBvSBg6M

zenith prism
#

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?

cold ingot
#

In my code

#

when i am trying to get cards

zenith prism
#

What request are you using to get cards?

cold ingot
#

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.";
}

zenith prism
#

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

#

Literally you need to do this:

$stripe = new \Stripe\StripeClient("sk_XXXXXX");
$stripe->customers->retrieve(
  'cus_Oj83Odmv2W5EV7',
  ['expand' => ['sources',]]
);
cold ingot
#

Is there anything else to do ?

zenith prism
#

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