#Ben21

1 messages ยท Page 1 of 1 (latest)

pseudo citrusBOT
tulip trail
#

Hello ๐Ÿ‘‹
customer property on a PaymentIntent is expandable so its not included by default
https://stripe.com/docs/api/payment_intents/object?lang=node#payment_intent_object-customer

So you'd need to expand it at retrieval time
https://stripe.com/docs/api/expanding_objects?lang=node

marble fractal
#

Thanks, when I try
$payment_intent = \Stripe\PaymentIntent::retrieve( $payment_intent_id, ['expand' => ['customer']] );

#

the customer key is NULL

tulip trail
#

Can you share the PaymentIntent ID you're looking at?

marble fractal
#

yes

#

pi_3MWgfhDVvpMi5GcV3KjQbtH5

tulip trail
marble fractal
#

Ok so what is the way to retrieve the customer ID from a previous payment

tulip trail
#

what previous payment?

marble fractal
#

from any payment made by a user on my website

#

on my side i just store the payment intent ID

#

but i need a proper customer ID so I can create a new paymentintent for a hold of 1000โ‚ฌ

tulip trail
#

If you did generate the customer ID and passed it to a PaymentIntent already then the code you've shared above should work

marble fractal
#

OK, i have no control over the first paymentintent customer creation, but when i do check it on stripe i can see that a guest customer is existing pn the stripe side

#

i cannot retrieve this "gcus_1MADvADVvpMi5GcVKB2V25zC" via API ?

tulip trail
marble fractal
#

Ok so my only chance is to create a real customer on the first payment

tulip trail
#

Yup

marble fractal
#

i am using a third party stripe gateway for the first payment so i guess it will be a headache to add that behavior

tulip trail
#

Ah gotcha, you would want to talk to them re this and see what they have to say about the behavior.

marble fractal
#

all right, thanks for your help

tulip trail
#

NP! ๐Ÿ™‚ Good luck