#sergixel04

1 messages · Page 1 of 1 (latest)

gray sapphireBOT
#

Hello sergixel04, we'll be with you shortly! Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
• sergixel04, 0 days ago, 78 messages
• sergixel04, 3 days ago, 62 messages
• sergixel04, 4 days ago, 11 messages

royal atlas
#

Hi there 👋 you'll want to use the function shown in the sample here to retrieve the Customer object:
https://stripe.com/docs/api/customers/retrieve?lang=php
Then check the invoice_settings.default_payment_method or default_source field on the Customer object (depending on where you're setting that value) to get the ID of their default payment method.

green lantern
#

Thank you toby, then I need to catch default_payment_method up and use it to get the last4?

gray sapphireBOT
royal atlas
green lantern
#

Fixed! Is it nominal

#

to get an empty array?

#

I used a testing customer_id

hollow sandal
#

Which customer id?

green lantern
#

is it safe to send this data?

hollow sandal
#

Yeah customer id isn't sensitive

#

Also send the code snippet you used

green lantern
#

alright thank you! cus_OprBn6o8zKJ6RP

$stripe = new \Stripe\StripeClient(config('app.stripe_secret'));
        $stripe->customers->retrieve(
            'cus_OprBn6o8zKJ6RP',
            ['expand' => ['invoice_settings.default_payment_method']]
        );
        return [$stripe];
hollow sandal
#

Yeah that's expected. That customer doesn't have invoice_settings.default_payment_method set

#

So that's why it was empty

green lantern
#

When I subscribed at the checkout and used 424242424242, doesn't automatically grab that card number as default payment method?

hollow sandal
#

No that's something you need to set

green lantern
#

Is there some setting or something in the dashboard? I am using Stripe Checkout

hollow sandal
green lantern
#

I have to handle this with webhooks?

#

If i go to user stripe dashboard billing I can see I have a payment method

hollow sandal
#

Yeah doing it through webhooks would be best

#

Are you accepting subscriptions or 1-time payments?

green lantern
#

I am accepting subscriptions

hollow sandal
#

Gotcha

#

Yeah webhooks are the best way I think

green lantern
#

Got it working, thank you so much @hollow sandal

hollow sandal
#

No problem

green lantern
#

Is there a way to associate a subscription item with some token or value?

I am thinking on how to handle when a subscriptor cancels one seat of the subscription (decrements the quantity by 1) how to identify that specific seat with my ddbb and got their other seats working, but the cancelled one down

hollow sandal
#

Couldn't you store subscription item id's in your database?

#

Or is it just 1 item?

#

With multiple quantities?

green lantern
#

Yep, exact is one item with multiple quantities

#

For example one item with 3 at quantity column

hollow sandal
#

This is something you'd need to keep track of in your db then