Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.x] Check if the default payment method is valid #1684

Closed
wants to merge 2 commits into from

Conversation

srmklive
Copy link

@srmklive srmklive commented Jun 27, 2024

This PR adds a method hasValidDefaultPaymentMethod which checks whether the user has a valid default payment method stored on Stripe.

Currently in cashier, we can check whether a user has a default payment method through:

hasDefaultPaymentMethod only checks for payment type.
defaultPaymentMethod -- only gives the default payment method details.

This method will check:

  • If defaultPaymentMethod returns null.
  • If defaultPaymentMethod returns payment method details. It will verify the payment method details from Stripe.

@srmklive srmklive force-pushed the 15.x branch 2 times, most recently from 5e60a28 to b6fdf2e Compare June 27, 2024 18:31
@driesvints driesvints changed the title [15.x] Check if the default payment method is valid. [15.x] Check if the default payment method is valid Jun 28, 2024
@driesvints
Copy link
Member

Bit confused here @srmklive. Why is hasDefaultPaymentMethod not enough for you? That should only return true if there's a valid default payment method in Stripe. Is that not happening for you?

@driesvints driesvints marked this pull request as draft June 28, 2024 07:39
@srmklive
Copy link
Author

@driesvints the ```hasDefaultPaymentMethod` method only returns if payment method type is set or not,

    /**
     * Determines if the customer currently has a default payment method.
     *
     * @return bool
     */
    public function hasDefaultPaymentMethod()
    {
        return (bool) $this->pm_type;
    }

@driesvints
Copy link
Member

But this type is only set if there's a valid default payment method on the customer in stripe. So again: why do you specifically need this new method?

@srmklive
Copy link
Author

We need this method is that they is no way to verify the default payment method in Cashier on Stripe. This method offers that check.

@driesvints
Copy link
Member

I still don't understand sorry. The pm_type method is only filled out when there's a valid default payment method. I don't see how this new method is differently other than it invokes an API call to Stripe. I'm going to close this one now but if you at some point can offer a thorough explanation why this is different from the current hasDefaultPaymentMethod then I'll be happy to revisit.

@driesvints driesvints closed this Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants